CRYPTO-C v1.1.3
C/C++ Documentation
blake2b.cuh File Reference
#include "blake2b.h"

Detailed Description

Blake2b CUDA hash function support.

This file is based on Dr. Markku-Juhani O. Saarinen's "somewhat smaller" BLAKE2 implemetation...

https://github.com/mjosaarinen/blake2_mjosref

... which was released into the Public Domain under the Creative Commons Zero v1.0 Universal license.

Functions

__device__ void cu_blake2b_compress (BLAKE2B_CTX *ctx, int last)
 Blake2b compression rounds. More...
 
__device__ int cu_blake2b_init (BLAKE2B_CTX *ctx, const void *key, int keylen, int outlen)
 Initialize a Blake2b context with optional key. More...
 
__device__ void cu_blake2b_update (BLAKE2B_CTX *ctx, const void *in, size_t inlen)
 Add inlen bytes from in to a Blake2b context for hashing. More...
 
__device__ void cu_blake2b_final (BLAKE2B_CTX *ctx, void *out)
 Finalize a Blake2b message digest. More...
 
__device__ int cu_blake2b (const void *in, size_t inlen, const void *key, int keylen, void *out, int outlen)
 Convenient all-in-one Blake2b computation. More...
 

Function Documentation

◆ cu_blake2b()

__device__ int cu_blake2b ( const void *  in,
size_t  inlen,
const void *  key,
int  keylen,
void *  out,
int  outlen 
)

Convenient all-in-one Blake2b computation.

Performs cu_blake2b_init(), cu_blake2b_update() and cu_blake2b_final(), and places the resulting hash in out.

Parameters
inPointer to data to hash
inlenLength of in data, in bytes
keyPointer to optional "key" input
keylenLength of optional key input, in bytes
outPointer to location to place the message digest
outlenLength* of desired message digest, in bytes
*compatible message digest lengths are 32, 48 and 64

◆ cu_blake2b_compress()

__device__ void cu_blake2b_compress ( BLAKE2B_CTX ctx,
int  last 
)

Blake2b compression rounds.

Parameters
ctxPointer to Blake2b context
lastFlag indicating the final compression

Blake2b compression Sigma. Used in compression rounds.

◆ cu_blake2b_final()

__device__ void cu_blake2b_final ( BLAKE2B_CTX ctx,
void *  out 
)

Finalize a Blake2b message digest.

Generate the Blake2b message digest and place in out.

Parameters
ctxPointer to Blake2b context
outPointer to location to place the message digest

◆ cu_blake2b_init()

__device__ int cu_blake2b_init ( BLAKE2B_CTX ctx,
const void *  key,
int  keylen,
int  outlen 
)

Initialize a Blake2b context with optional key.

To hash without a key, specify NULL and 0 for key and keylen, respectively.

Parameters
ctxPointer to Blake2b context
keyPointer to optional "key" input
keylenLength of optional key input, in bytes
outlenByte length of desired digest
Returns
0 on success, else if initialization fails (-1).
Note
Blake2b initialization can fail if keylen is greater than 64 or outlen is not a supported digest length. Supported lengths include: 32 (256-bits), 48 (384-bits) or 64 (512-bits).

◆ cu_blake2b_update()

__device__ void cu_blake2b_update ( BLAKE2B_CTX ctx,
const void *  in,
size_t  inlen 
)

Add inlen bytes from in to a Blake2b context for hashing.

Parameters
ctxPointer to Blake2b context
inPointer to data to hash
inlenLength of in data, in bytes