InChI
 
Loading...
Searching...
No Matches
sha2.h File Reference
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  sha2_context
 SHA-256 context structure. More...
 

Functions

void sha2_starts (sha2_context *ctx)
 SHA-256 context setup.
 
void sha2_update (sha2_context *ctx, unsigned char *input, int ilen)
 SHA-256 process buffer.
 
void sha2_finish (sha2_context *ctx, unsigned char output[32])
 SHA-256 final digest.
 
void sha2_csum (unsigned char *input, int ilen, unsigned char output[32])
 Output = SHA-256( input buffer )
 
int sha2_file (char *path, unsigned char output[32])
 Output = SHA-256( file contents )
 
void sha2_hmac (unsigned char *key, int keylen, unsigned char *input, int ilen, unsigned char output[32])
 Output = HMAC-SHA-256( input buffer, hmac key )
 
int sha2_self_test (void)
 Checkup routine.
 

Function Documentation

◆ sha2_csum()

void sha2_csum ( unsigned char *  input,
int  ilen,
unsigned char  output[32] 
)

Output = SHA-256( input buffer )

Parameters
inputbuffer holding the data
ilenlength of the input data
outputSHA-256 checksum result
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sha2_file()

int sha2_file ( char *  path,
unsigned char  output[32] 
)

Output = SHA-256( file contents )

Parameters
pathinput file name
outputSHA-256 checksum result
Returns
0 if successful, or 1 if fopen failed
+ Here is the call graph for this function:

◆ sha2_finish()

void sha2_finish ( sha2_context ctx,
unsigned char  output[32] 
)

SHA-256 final digest.

Parameters
ctxSHA-256 context
outputSHA-256 checksum result
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sha2_hmac()

void sha2_hmac ( unsigned char *  key,
int  keylen,
unsigned char *  input,
int  ilen,
unsigned char  output[32] 
)

Output = HMAC-SHA-256( input buffer, hmac key )

Parameters
keyHMAC secret key
keylenlength of the HMAC key
inputbuffer holding the data
ilenlength of the input data
outputHMAC-SHA-256 result
+ Here is the call graph for this function:

◆ sha2_self_test()

int sha2_self_test ( void  )

Checkup routine.

Returns
0 if successful, or 1 if the test failed

◆ sha2_starts()

void sha2_starts ( sha2_context ctx)

SHA-256 context setup.

Parameters
ctxSHA-256 context to be initialized
+ Here is the caller graph for this function:

◆ sha2_update()

void sha2_update ( sha2_context ctx,
unsigned char *  input,
int  ilen 
)

SHA-256 process buffer.

Parameters
ctxSHA-256 context
inputbuffer holding the data
ilenlength of the input data
+ Here is the call graph for this function:
+ Here is the caller graph for this function: