![]() |
CRYPTO-C v1.1.3
C/C++ Documentation
|
#include "sha3.h"
SHA3 CUDA hash function support.
This file is based on Dr. Markku-Juhani O. Saarinen's "cooked up" compact and readable keccak implemetation...
... which was released under the MIT license (MIT).
Alterations to the transform function were based on Marko Kreen's optimized C implementation...
... which was released under the ISC License (ISC).
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Functions | |
__device__ void | cu_sha3_keccakf (uint64_t st[]) |
SHA3_Keccak permutation rounds. More... | |
__device__ void | cu_sha3_init (SHA3_KECCAK_CTX *ctx, int outlen) |
Initialize a SHA3 context. More... | |
__device__ void | cu_keccak_init (SHA3_KECCAK_CTX *ctx, int outlen) |
Initialize a Keccak context. More... | |
__device__ void | cu_sha3_update (SHA3_KECCAK_CTX *ctx, const void *in, size_t inlen) |
Add inlen bytes from in to a SHA3 context for hashing. More... | |
__device__ void | cu_keccak_update (SHA3_KECCAK_CTX *ctx, const void *in, size_t inlen) |
Add inlen bytes from in to a Keccak context for hashing. More... | |
__device__ void | cu_sha3_final (SHA3_KECCAK_CTX *ctx, void *out) |
Finalize a SHA3 message digest. More... | |
__device__ void | cu_keccak_final (SHA3_KECCAK_CTX *ctx, void *out) |
Finalize a Keccak message digest. More... | |
__device__ void | cu_sha3 (const void *in, size_t inlen, void *out, int outlen) |
Convenient all-in-one SHA3 computation. More... | |
__device__ void | cu_keccak (const void *in, size_t inlen, void *out, int outlen) |
Convenient all-in-one Keccak computation. More... | |
__device__ void cu_keccak | ( | const void * | in, |
size_t | inlen, | ||
void * | out, | ||
int | outlen | ||
) |
Convenient all-in-one Keccak computation.
Performs keccak_init(), keccak_update() and keccak_final(), and places the resulting hash in out.
in | Pointer to data to hash |
inlen | Length of in data, in bytes |
out | Pointer to location to place the message digest |
outlen | Length* of desired message digest, in bytes *compatible message digest lengths are 28, 32, 48 and 64 |
__device__ void cu_keccak_final | ( | SHA3_KECCAK_CTX * | ctx, |
void * | out | ||
) |
Finalize a Keccak message digest.
Generate the Keccak message digest and place in out.
ctx | Pointer to Keccak context |
out | Pointer to location to place the message digest |
__device__ void cu_keccak_init | ( | SHA3_KECCAK_CTX * | ctx, |
int | outlen | ||
) |
Initialize a Keccak context.
ctx | Pointer to Keccak context |
outlen | Length* of desired message digest, in bytes *compatible message digest lengths are 28, 32, 48 and 64 |
__device__ void cu_keccak_update | ( | SHA3_KECCAK_CTX * | ctx, |
const void * | in, | ||
size_t | inlen | ||
) |
Add inlen bytes from in to a Keccak context for hashing.
ctx | Pointer to Keccak context |
in | Pointer to data to hash |
inlen | Length of in data, in bytes |
__device__ void cu_sha3 | ( | const void * | in, |
size_t | inlen, | ||
void * | out, | ||
int | outlen | ||
) |
Convenient all-in-one SHA3 computation.
Performs sha3_init(), sha3_update() and sha3_final(), and places the resulting hash in out.
in | Pointer to data to hash |
inlen | Length of in data, in bytes |
out | Pointer to location to place the message digest |
outlen | Length* of desired message digest, in bytes *compatible message digest lengths are 28, 32, 48 and 64 |
__device__ void cu_sha3_final | ( | SHA3_KECCAK_CTX * | ctx, |
void * | out | ||
) |
Finalize a SHA3 message digest.
Generate the SHA3 message digest and place in out.
ctx | Pointer to SHA3 context |
out | Pointer to location to place the message digest |
__device__ void cu_sha3_init | ( | SHA3_KECCAK_CTX * | ctx, |
int | outlen | ||
) |
Initialize a SHA3 context.
ctx | Pointer to SHA3 context |
outlen | Length* of desired message digest, in bytes *compatible message digest lengths are 28, 32, 48 and 64 |
__device__ void cu_sha3_keccakf | ( | uint64_t | st[] | ) |
SHA3_Keccak permutation rounds.
st | Pointer to context state array |
Keccakf round constant.
__device__ void cu_sha3_update | ( | SHA3_KECCAK_CTX * | ctx, |
const void * | in, | ||
size_t | inlen | ||
) |
Add inlen bytes from in to a SHA3 context for hashing.
ctx | Pointer to SHA3 context |
in | Pointer to data to hash |
inlen | Length of in data, in bytes |