D:/opendownloadmanager/ODM-1.x/Hash/sha2.h File Reference

#include <limits.h>
#include "sha2.cpp"

Go to the source code of this file.

Classes

struct  sha256_ctx
struct  sha512_ctx
struct  sha2_ctx

Defines

#define sfx_lo(x, y)   x##y
#define sfx_hi(x, y)   sfx_lo(x,y)
#define n_u32(p)   sfx_hi(0x##p,s_u32)
#define n_u64(p)   sfx_hi(0x##p,s_u64)
#define SHA256_DIGEST_SIZE   32
#define SHA384_DIGEST_SIZE   48
#define SHA512_DIGEST_SIZE   64
#define SHA256_BLOCK_SIZE   64
#define SHA384_BLOCK_SIZE   128
#define SHA512_BLOCK_SIZE   128
#define SHA2_DIGEST_SIZE   SHA256_DIGEST_SIZE
#define SHA2_MAX_DIGEST_SIZE   SHA512_DIGEST_SIZE
#define SHA2_GOOD   0
#define SHA2_BAD   1
#define sha384_hash   sha512_hash

Typedefs

typedef sha512_ctx sha384_ctx

Functions

void sha256_compile (sha256_ctx ctx[1])
void sha512_compile (sha512_ctx ctx[1])
void sha256_begin (sha256_ctx ctx[1])
void sha256_hash (const unsigned char data[], unsigned long len, sha256_ctx ctx[1])
void sha256_end (unsigned char hval[], sha256_ctx ctx[1])
void sha256 (unsigned char hval[], const unsigned char data[], unsigned long len)
void sha384_begin (sha384_ctx ctx[1])
void sha384_end (unsigned char hval[], sha384_ctx ctx[1])
void sha384 (unsigned char hval[], const unsigned char data[], unsigned long len)
void sha512_begin (sha512_ctx ctx[1])
void sha512_hash (const unsigned char data[], unsigned long len, sha512_ctx ctx[1])
void sha512_end (unsigned char hval[], sha512_ctx ctx[1])
void sha512 (unsigned char hval[], const unsigned char data[], unsigned long len)
int sha2_begin (unsigned long size, sha2_ctx ctx[1])
void sha2_hash (const unsigned char data[], unsigned long len, sha2_ctx ctx[1])
void sha2_end (unsigned char hval[], sha2_ctx ctx[1])
int sha2 (unsigned char hval[], unsigned long size, const unsigned char data[], unsigned long len)


Define Documentation

#define n_u32 (  )     sfx_hi(0x##p,s_u32)

Definition at line 12 of file sha2.h.

#define n_u64 (  )     sfx_hi(0x##p,s_u64)

Definition at line 13 of file sha2.h.

#define sfx_hi ( x,
 )     sfx_lo(x,y)

Definition at line 11 of file sha2.h.

#define sfx_lo ( x,
 )     x##y

Definition at line 10 of file sha2.h.

#define SHA256_BLOCK_SIZE   64

Definition at line 47 of file sha2.h.

Referenced by sha256_end(), and sha256_hash().

#define SHA256_DIGEST_SIZE   32

Definition at line 43 of file sha2.h.

Referenced by sha256_end().

#define SHA2_BAD   1

Definition at line 55 of file sha2.h.

#define SHA2_DIGEST_SIZE   SHA256_DIGEST_SIZE

Definition at line 51 of file sha2.h.

#define SHA2_GOOD   0

Definition at line 54 of file sha2.h.

#define SHA2_MAX_DIGEST_SIZE   SHA512_DIGEST_SIZE

Definition at line 52 of file sha2.h.

#define SHA384_BLOCK_SIZE   128

Definition at line 48 of file sha2.h.

#define SHA384_DIGEST_SIZE   48

Definition at line 44 of file sha2.h.

Referenced by sha2_end(), and sha384_end().

#define sha384_hash   sha512_hash

Definition at line 88 of file sha2.h.

Referenced by sha2_hash(), and sha384().

#define SHA512_BLOCK_SIZE   128

Definition at line 49 of file sha2.h.

Referenced by sha512_hash(), and sha_end().

#define SHA512_DIGEST_SIZE   64

Definition at line 45 of file sha2.h.

Referenced by sha2_end(), and sha512_end().


Typedef Documentation

Definition at line 69 of file sha2.h.


Function Documentation

int sha2 ( unsigned char  hval[],
unsigned long  size,
const unsigned char  data[],
unsigned long  len 
)

Definition at line 536 of file sha2.cpp.

References SHA2_BAD, sha2_begin(), sha2_end(), SHA2_GOOD, and sha2_hash().

Referenced by vmsHash::Hash_SHA2().

void sha256 ( unsigned char  hval[],
const unsigned char  data[],
unsigned long  len 
)

Definition at line 252 of file sha2.cpp.

References sha256_begin(), sha256_end(), and sha256_hash().

void sha256_begin ( sha256_ctx  ctx[1]  ) 

Definition at line 157 of file sha2.cpp.

References sha256_ctx::count, sha256_ctx::hash, and i256.

Referenced by sha256().

void sha256_compile ( sha256_ctx  ctx[1]  ) 

Definition at line 163 of file sha2.cpp.

References h2_cycle, and sha256_ctx::hash.

Referenced by sha256_end(), and sha256_hash().

void sha256_end ( unsigned char  hval[],
sha256_ctx  ctx[1] 
)

void sha256_hash ( const unsigned char  data[],
unsigned long  len,
sha256_ctx  ctx[1] 
)

Definition at line 180 of file sha2.cpp.

References bsw_32, sha256_ctx::count, pos(), SHA256_BLOCK_SIZE, sha256_compile(), SHA256_MASK, and sha256_ctx::wbuf.

Referenced by sha256(), and sha2_hash().

int sha2_begin ( unsigned long  size,
sha2_ctx  ctx[1] 
)

Definition at line 497 of file sha2.cpp.

References CTX_256, CTX_384, CTX_512, i256, i384, i512, l, SHA2_BAD, SHA2_GOOD, and sha2_ctx::sha2_len.

Referenced by vmsHash::Hash_SHA2(), and sha2().

void sha2_end ( unsigned char  hval[],
sha2_ctx  ctx[1] 
)

void sha2_hash ( const unsigned char  data[],
unsigned long  len,
sha2_ctx  ctx[1] 
)

Definition at line 516 of file sha2.cpp.

References CTX_256, CTX_384, CTX_512, sha256_hash(), sha2_ctx::sha2_len, sha384_hash, and sha512_hash().

Referenced by vmsHash::Hash_SHA2(), and sha2().

void sha384 ( unsigned char  hval[],
const unsigned char  data[],
unsigned long  len 
)

Definition at line 454 of file sha2.cpp.

References sha384_begin(), sha384_end(), and sha384_hash.

void sha384_begin ( sha384_ctx  ctx[1]  ) 

Definition at line 443 of file sha2.cpp.

References sha512_ctx::count, sha512_ctx::hash, and i384.

Referenced by sha384().

void sha384_end ( unsigned char  hval[],
sha384_ctx  ctx[1] 
)

Definition at line 449 of file sha2.cpp.

References SHA384_DIGEST_SIZE, and sha_end().

Referenced by sha384().

void sha512 ( unsigned char  hval[],
const unsigned char  data[],
unsigned long  len 
)

Definition at line 483 of file sha2.cpp.

References sha512_begin(), sha512_end(), and sha512_hash().

void sha512_begin ( sha512_ctx  ctx[1]  ) 

Definition at line 472 of file sha2.cpp.

References sha512_ctx::count, sha512_ctx::hash, and i512.

Referenced by sha512().

void sha512_compile ( sha512_ctx  ctx[1]  ) 

Definition at line 334 of file sha2.cpp.

References h5_cycle, and sha512_ctx::hash.

Referenced by sha512_hash(), and sha_end().

void sha512_end ( unsigned char  hval[],
sha512_ctx  ctx[1] 
)

Definition at line 478 of file sha2.cpp.

References SHA512_DIGEST_SIZE, and sha_end().

Referenced by sha512().

void sha512_hash ( const unsigned char  data[],
unsigned long  len,
sha512_ctx  ctx[1] 
)

Definition at line 352 of file sha2.cpp.

References bsw_64, sha512_ctx::count, pos(), SHA512_BLOCK_SIZE, sha512_compile(), SHA512_MASK, and sha512_ctx::wbuf.

Referenced by sha2_hash(), and sha512().


Generated on Sun May 25 00:19:53 2008 by  doxygen 1.5.6