Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 #ifndef _SHA2_H
00039 #define _SHA2_H
00040
00041
00042 #define SHA256_Init pg_SHA256_Init
00043 #define SHA256_Update pg_SHA256_Update
00044 #define SHA256_Final pg_SHA256_Final
00045 #define SHA384_Init pg_SHA384_Init
00046 #define SHA384_Update pg_SHA384_Update
00047 #define SHA384_Final pg_SHA384_Final
00048 #define SHA512_Init pg_SHA512_Init
00049 #define SHA512_Update pg_SHA512_Update
00050 #define SHA512_Final pg_SHA512_Final
00051
00052
00053 #define SHA224_BLOCK_LENGTH 64
00054 #define SHA224_DIGEST_LENGTH 28
00055 #define SHA224_DIGEST_STRING_LENGTH (SHA224_DIGEST_LENGTH * 2 + 1)
00056 #define SHA256_BLOCK_LENGTH 64
00057 #define SHA256_DIGEST_LENGTH 32
00058 #define SHA256_DIGEST_STRING_LENGTH (SHA256_DIGEST_LENGTH * 2 + 1)
00059 #define SHA384_BLOCK_LENGTH 128
00060 #define SHA384_DIGEST_LENGTH 48
00061 #define SHA384_DIGEST_STRING_LENGTH (SHA384_DIGEST_LENGTH * 2 + 1)
00062 #define SHA512_BLOCK_LENGTH 128
00063 #define SHA512_DIGEST_LENGTH 64
00064 #define SHA512_DIGEST_STRING_LENGTH (SHA512_DIGEST_LENGTH * 2 + 1)
00065
00066
00067
00068 typedef struct _SHA256_CTX
00069 {
00070 uint32 state[8];
00071 uint64 bitcount;
00072 uint8 buffer[SHA256_BLOCK_LENGTH];
00073 } SHA256_CTX;
00074 typedef struct _SHA512_CTX
00075 {
00076 uint64 state[8];
00077 uint64 bitcount[2];
00078 uint8 buffer[SHA512_BLOCK_LENGTH];
00079 } SHA512_CTX;
00080
00081 typedef SHA256_CTX SHA224_CTX;
00082 typedef SHA512_CTX SHA384_CTX;
00083
00084 void SHA224_Init(SHA224_CTX *);
00085 void SHA224_Update(SHA224_CTX *, const uint8 *, size_t);
00086 void SHA224_Final(uint8[SHA224_DIGEST_LENGTH], SHA224_CTX *);
00087
00088 void SHA256_Init(SHA256_CTX *);
00089 void SHA256_Update(SHA256_CTX *, const uint8 *, size_t);
00090 void SHA256_Final(uint8[SHA256_DIGEST_LENGTH], SHA256_CTX *);
00091
00092 void SHA384_Init(SHA384_CTX *);
00093 void SHA384_Update(SHA384_CTX *, const uint8 *, size_t);
00094 void SHA384_Final(uint8[SHA384_DIGEST_LENGTH], SHA384_CTX *);
00095
00096 void SHA512_Init(SHA512_CTX *);
00097 void SHA512_Update(SHA512_CTX *, const uint8 *, size_t);
00098 void SHA512_Final(uint8[SHA512_DIGEST_LENGTH], SHA512_CTX *);
00099
00100 #endif