Browse Source

Clean up SHA1Reset

pull/25/head
Anders Jenbo 8 years ago committed by Dennis Duda
parent
commit
3877d77b55
  1. 19
      Source/sha.cpp
  2. 5
      Source/sha.h

19
Source/sha.cpp

@ -121,11 +121,16 @@ void __fastcall SHA1ProcessMessageBlock(SHA1Context *context)
void __fastcall SHA1Reset(int n)
{
sgSHA1[n].count[0] = 0;
sgSHA1[n].count[1] = 0;
sgSHA1[n].state[0] = 0x67452301;
sgSHA1[n].state[1] = 0xEFCDAB89;
sgSHA1[n].state[2] = 0x98BADCFE;
sgSHA1[n].state[3] = 0x10325476;
sgSHA1[n].state[4] = 0xC3D2E1F0;
SHA1Init(&sgSHA1[n]);
}
void __fastcall SHA1Init(SHA1Context *context)
{
context->count[0] = 0;
context->count[1] = 0;
context->state[0] = 0x67452301;
context->state[1] = 0xEFCDAB89;
context->state[2] = 0x98BADCFE;
context->state[3] = 0x10325476;
context->state[4] = 0xC3D2E1F0;
}

5
Source/sha.h

@ -5,8 +5,8 @@
/*
* Define the SHA1 circular left shift macro
*/
#define SHA1CircularShift(bits,word) \
(((word) << (bits)) | ((word) >> (32-(bits))))
#define SHA1CircularShift(bits, word) \
(((word) << (bits)) | ((word) >> (32 - (bits))))
#define SHA1HashSize 20
//sha
@ -18,5 +18,6 @@ void __fastcall SHA1Calculate(int n, const char *data, char Message_Digest[SHA1H
void __fastcall SHA1Input(SHA1Context *context, const char *message_array, int len);
void __fastcall SHA1ProcessMessageBlock(SHA1Context *context);
void __fastcall SHA1Reset(int n);
void __fastcall SHA1Init(SHA1Context *context);
#endif /* __SHA_H__ */

Loading…
Cancel
Save