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

Detailed Description

SHA256 CUDA hash function support.

This file is based on Brad Conte's basic implementations of cryptography algorithms...

https://github.com/B-Con/crypto-algorithms

... and alterations to the transform function were based on Igor Pavlov's SHA256 implementation...

https://github.com/jb55/sha256.c

... both of which were released into the Public Domain.

Functions

__device__ void cu_sha256_transform (SHA256_CTX *ctx, const uint8_t data[])
 SHA256 transformation rounds. More...
 
__device__ void cu_sha256_init (SHA256_CTX *ctx)
 Initialize a SHA256 context. More...
 
__device__ void cu_sha256_update (SHA256_CTX *ctx, const void *in, size_t inlen)
 Add inlen bytes from in to a SHA256 context for hashing. More...
 
__device__ void cu_sha256_final (SHA256_CTX *ctx, void *out)
 Finalize a SHA256 message digest. More...
 
__device__ void cu_sha256 (const void *in, size_t inlen, void *out)
 Convenient all-in-one SHA256 computation. More...
 

Function Documentation

◆ cu_sha256()

__device__ void cu_sha256 ( const void *  in,
size_t  inlen,
void *  out 
)

Convenient all-in-one SHA256 computation.

Performs cu_sha256_init(), cu_sha256_update() and cu_sha256_final(), and places the resulting hash in out.

Parameters
inPointer to data to hash
inlenLength of in data, in bytes
outPointer to location to place the message digest

◆ cu_sha256_final()

__device__ void cu_sha256_final ( SHA256_CTX ctx,
void *  out 
)

Finalize a SHA256 message digest.

Generate the SHA256 message digest and place in out.

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

◆ cu_sha256_init()

__device__ void cu_sha256_init ( SHA256_CTX ctx)

Initialize a SHA256 context.

Parameters
ctxPointer to SHA256 context

◆ cu_sha256_transform()

__device__ void cu_sha256_transform ( SHA256_CTX ctx,
const uint8_t  data[] 
)

SHA256 transformation rounds.

Parameters
ctxPointer to SHA256 context
dataPointer to input to be transformed

SHA256 transformation constan

◆ cu_sha256_update()

__device__ void cu_sha256_update ( SHA256_CTX ctx,
const void *  in,
size_t  inlen 
)

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

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