libmoost
/home/mhx/git/github/libmoost/src/digest/rfc6234/sha.h File Reference
#include <stdint.h>
Include dependency graph for sha.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  SHA1Context
struct  SHA256Context
struct  SHA512Context
struct  USHAContext
struct  HMACContext
struct  HKDFContext

Defines

#define _SHA_enum_

Typedefs

typedef enum SHAversion SHAversion
typedef struct SHA1Context SHA1Context
typedef struct SHA256Context SHA256Context
typedef struct SHA512Context SHA512Context
typedef struct SHA256Context SHA224Context
typedef struct SHA512Context SHA384Context
typedef struct USHAContext USHAContext
typedef struct HMACContext HMACContext
typedef struct HKDFContext HKDFContext

Enumerations

enum  {
  shaSuccess = 0, shaNull, shaInputTooLong, shaStateError,
  shaBadParam
}
enum  {
  SHA1_Message_Block_Size = 64, SHA224_Message_Block_Size = 64, SHA256_Message_Block_Size = 64, SHA384_Message_Block_Size = 128,
  SHA512_Message_Block_Size = 128, USHA_Max_Message_Block_Size = SHA512_Message_Block_Size, SHA1HashSize = 20, SHA224HashSize = 28,
  SHA256HashSize = 32, SHA384HashSize = 48, SHA512HashSize = 64, USHAMaxHashSize = SHA512HashSize,
  SHA1HashSizeBits = 160, SHA224HashSizeBits = 224, SHA256HashSizeBits = 256, SHA384HashSizeBits = 384,
  SHA512HashSizeBits = 512, USHAMaxHashSizeBits = SHA512HashSizeBits
}
enum  SHAversion {
  SHA1, SHA224, SHA256, SHA384,
  SHA512
}

Functions

int SHA1Reset (SHA1Context *)
int SHA1Input (SHA1Context *, const uint8_t *bytes, unsigned int bytecount)
int SHA1FinalBits (SHA1Context *, uint8_t bits, unsigned int bit_count)
int SHA1Result (SHA1Context *, uint8_t Message_Digest[SHA1HashSize])
int SHA224Reset (SHA224Context *)
int SHA224Input (SHA224Context *, const uint8_t *bytes, unsigned int bytecount)
int SHA224FinalBits (SHA224Context *, uint8_t bits, unsigned int bit_count)
int SHA224Result (SHA224Context *, uint8_t Message_Digest[SHA224HashSize])
int SHA256Reset (SHA256Context *)
int SHA256Input (SHA256Context *, const uint8_t *bytes, unsigned int bytecount)
int SHA256FinalBits (SHA256Context *, uint8_t bits, unsigned int bit_count)
int SHA256Result (SHA256Context *, uint8_t Message_Digest[SHA256HashSize])
int SHA384Reset (SHA384Context *)
int SHA384Input (SHA384Context *, const uint8_t *bytes, unsigned int bytecount)
int SHA384FinalBits (SHA384Context *, uint8_t bits, unsigned int bit_count)
int SHA384Result (SHA384Context *, uint8_t Message_Digest[SHA384HashSize])
int SHA512Reset (SHA512Context *)
int SHA512Input (SHA512Context *, const uint8_t *bytes, unsigned int bytecount)
int SHA512FinalBits (SHA512Context *, uint8_t bits, unsigned int bit_count)
int SHA512Result (SHA512Context *, uint8_t Message_Digest[SHA512HashSize])
int USHAReset (USHAContext *context, SHAversion whichSha)
int USHAInput (USHAContext *context, const uint8_t *bytes, unsigned int bytecount)
int USHAFinalBits (USHAContext *context, uint8_t bits, unsigned int bit_count)
int USHAResult (USHAContext *context, uint8_t Message_Digest[USHAMaxHashSize])
int USHABlockSize (enum SHAversion whichSha)
int USHAHashSize (enum SHAversion whichSha)
int USHAHashSizeBits (enum SHAversion whichSha)
const char * USHAHashName (enum SHAversion whichSha)
int hmac (SHAversion whichSha, const unsigned char *text, int text_len, const unsigned char *key, int key_len, uint8_t digest[USHAMaxHashSize])
int hmacReset (HMACContext *context, enum SHAversion whichSha, const unsigned char *key, int key_len)
int hmacInput (HMACContext *context, const unsigned char *text, int text_len)
int hmacFinalBits (HMACContext *context, uint8_t bits, unsigned int bit_count)
int hmacResult (HMACContext *context, uint8_t digest[USHAMaxHashSize])
int hkdf (SHAversion whichSha, const unsigned char *salt, int salt_len, const unsigned char *ikm, int ikm_len, const unsigned char *info, int info_len, uint8_t okm[], int okm_len)
int hkdfExtract (SHAversion whichSha, const unsigned char *salt, int salt_len, const unsigned char *ikm, int ikm_len, uint8_t prk[USHAMaxHashSize])
int hkdfExpand (SHAversion whichSha, const uint8_t prk[], int prk_len, const unsigned char *info, int info_len, uint8_t okm[], int okm_len)
int hkdfReset (HKDFContext *context, enum SHAversion whichSha, const unsigned char *salt, int salt_len)
int hkdfInput (HKDFContext *context, const unsigned char *ikm, int ikm_len)
int hkdfFinalBits (HKDFContext *context, uint8_t ikm_bits, unsigned int ikm_bit_count)
int hkdfResult (HKDFContext *context, uint8_t prk[USHAMaxHashSize], const unsigned char *info, int info_len, uint8_t okm[USHAMaxHashSize], int okm_len)

Define Documentation

#define _SHA_enum_

Definition at line 87 of file sha.h.


Typedef Documentation

typedef struct HKDFContext HKDFContext
typedef struct HMACContext HMACContext
typedef struct SHA1Context SHA1Context
typedef struct SHA256Context SHA224Context

Definition at line 187 of file sha.h.

typedef struct SHA256Context SHA256Context
typedef struct SHA512Context SHA384Context

Definition at line 193 of file sha.h.

typedef struct SHA512Context SHA512Context
typedef enum SHAversion SHAversion
typedef struct USHAContext USHAContext

Enumeration Type Documentation

anonymous enum
Enumerator:
shaSuccess 
shaNull 
shaInputTooLong 
shaStateError 
shaBadParam 

Definition at line 91 of file sha.h.

anonymous enum
Enumerator:
SHA1_Message_Block_Size 
SHA224_Message_Block_Size 
SHA256_Message_Block_Size 
SHA384_Message_Block_Size 
SHA512_Message_Block_Size 
USHA_Max_Message_Block_Size 
SHA1HashSize 
SHA224HashSize 
SHA256HashSize 
SHA384HashSize 
SHA512HashSize 
USHAMaxHashSize 
SHA1HashSizeBits 
SHA224HashSizeBits 
SHA256HashSizeBits 
SHA384HashSizeBits 
SHA512HashSizeBits 
USHAMaxHashSizeBits 

Definition at line 104 of file sha.h.

enum SHAversion
Enumerator:
SHA1 
SHA224 
SHA256 
SHA384 
SHA512 

Definition at line 122 of file sha.h.


Function Documentation

int hkdf ( SHAversion  whichSha,
const unsigned char *  salt,
int  salt_len,
const unsigned char *  ikm,
int  ikm_len,
const unsigned char *  info,
int  info_len,
uint8_t  okm[],
int  okm_len 
)
int hkdfExpand ( SHAversion  whichSha,
const uint8_t  prk[],
int  prk_len,
const unsigned char *  info,
int  info_len,
uint8_t  okm[],
int  okm_len 
)
int hkdfExtract ( SHAversion  whichSha,
const unsigned char *  salt,
int  salt_len,
const unsigned char *  ikm,
int  ikm_len,
uint8_t  prk[USHAMaxHashSize] 
)
int hkdfFinalBits ( HKDFContext context,
uint8_t  ikm_bits,
unsigned int  ikm_bit_count 
)
int hkdfInput ( HKDFContext context,
const unsigned char *  ikm,
int  ikm_len 
)
int hkdfReset ( HKDFContext context,
enum SHAversion  whichSha,
const unsigned char *  salt,
int  salt_len 
)
int hkdfResult ( HKDFContext context,
uint8_t  prk[USHAMaxHashSize],
const unsigned char *  info,
int  info_len,
uint8_t  okm[USHAMaxHashSize],
int  okm_len 
)
int hmac ( SHAversion  whichSha,
const unsigned char *  text,
int  text_len,
const unsigned char *  key,
int  key_len,
uint8_t  digest[USHAMaxHashSize] 
)
int hmacFinalBits ( HMACContext context,
uint8_t  bits,
unsigned int  bit_count 
)
int hmacInput ( HMACContext context,
const unsigned char *  text,
int  text_len 
)
int hmacReset ( HMACContext context,
enum SHAversion  whichSha,
const unsigned char *  key,
int  key_len 
)
int hmacResult ( HMACContext context,
uint8_t  digest[USHAMaxHashSize] 
)
int SHA1FinalBits ( SHA1Context ,
uint8_t  bits,
unsigned int  bit_count 
)

Definition at line 162 of file sha1.c.

Here is the call graph for this function:

int SHA1Input ( SHA1Context ,
const uint8_t *  bytes,
unsigned int  bytecount 
)
int SHA1Reset ( SHA1Context )

Definition at line 80 of file sha1.c.

int SHA1Result ( SHA1Context ,
uint8_t  Message_Digest[SHA1HashSize] 
)

Definition at line 212 of file sha1.c.

Here is the call graph for this function:

int SHA224FinalBits ( SHA224Context ,
uint8_t  bits,
unsigned int  bit_count 
)

Definition at line 160 of file sha224-256.c.

Here is the call graph for this function:

int SHA224Input ( SHA224Context ,
const uint8_t *  bytes,
unsigned int  bytecount 
)

Definition at line 135 of file sha224-256.c.

Here is the call graph for this function:

Definition at line 110 of file sha224-256.c.

Here is the call graph for this function:

int SHA224Result ( SHA224Context ,
uint8_t  Message_Digest[SHA224HashSize] 
)

Definition at line 185 of file sha224-256.c.

Here is the call graph for this function:

int SHA256FinalBits ( SHA256Context ,
uint8_t  bits,
unsigned int  bit_count 
)

Definition at line 272 of file sha224-256.c.

Here is the call graph for this function:

Here is the caller graph for this function:

int SHA256Input ( SHA256Context ,
const uint8_t *  bytes,
unsigned int  bytecount 
)

Definition at line 229 of file sha224-256.c.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 205 of file sha224-256.c.

Here is the call graph for this function:

int SHA256Result ( SHA256Context ,
uint8_t  Message_Digest[SHA256HashSize] 
)

Definition at line 320 of file sha224-256.c.

Here is the call graph for this function:

int SHA384FinalBits ( SHA384Context ,
uint8_t  bits,
unsigned int  bit_count 
)

Definition at line 399 of file sha384-512.c.

Here is the call graph for this function:

int SHA384Input ( SHA384Context ,
const uint8_t *  bytes,
unsigned int  bytecount 
)

Definition at line 373 of file sha384-512.c.

Here is the call graph for this function:

Definition at line 348 of file sha384-512.c.

Here is the call graph for this function:

int SHA384Result ( SHA384Context ,
uint8_t  Message_Digest[SHA384HashSize] 
)

Definition at line 425 of file sha384-512.c.

Here is the call graph for this function:

int SHA512FinalBits ( SHA512Context ,
uint8_t  bits,
unsigned int  bit_count 
)

Definition at line 515 of file sha384-512.c.

Here is the call graph for this function:

Here is the caller graph for this function:

int SHA512Input ( SHA512Context ,
const uint8_t *  bytes,
unsigned int  bytecount 
)

Definition at line 471 of file sha384-512.c.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 446 of file sha384-512.c.

Here is the call graph for this function:

int SHA512Result ( SHA512Context ,
uint8_t  Message_Digest[SHA512HashSize] 
)

Definition at line 564 of file sha384-512.c.

Here is the call graph for this function:

int USHABlockSize ( enum SHAversion  whichSha)
int USHAFinalBits ( USHAContext context,
uint8_t  bits,
unsigned int  bit_count 
)
const char* USHAHashName ( enum SHAversion  whichSha)
int USHAHashSize ( enum SHAversion  whichSha)
int USHAHashSizeBits ( enum SHAversion  whichSha)
int USHAInput ( USHAContext context,
const uint8_t *  bytes,
unsigned int  bytecount 
)
int USHAReset ( USHAContext context,
SHAversion  whichSha 
)
int USHAResult ( USHAContext context,
uint8_t  Message_Digest[USHAMaxHashSize] 
)