Fork of François Berder Crypto, fixed AES CBC and small rework
Dependents: AES_example shaun_larada Smartage
Fork of Crypto by
Diff: SHA1.cpp
- Revision:
- 5:06cd9c8afa0b
- Parent:
- 4:0da19393bd57
- Child:
- 6:19aa835f2bbb
diff -r 0da19393bd57 -r 06cd9c8afa0b SHA1.cpp --- a/SHA1.cpp Thu Sep 12 10:18:57 2013 +0000 +++ b/SHA1.cpp Thu Sep 12 15:08:51 2013 +0000 @@ -59,7 +59,7 @@ return 20; } -void SHA1::add(uint8_t *in, uint32_t length) +void SHA1::update(uint8_t *in, uint32_t length) { if(length < 64-bufferLength) { @@ -84,7 +84,7 @@ totalBufferLength += length; } -void SHA1::computeDigest(uint8_t *digest) +void SHA1::finalize(uint8_t *digest) { uint32_t *digest2 = (uint32_t*)digest; uint16_t padding; @@ -101,7 +101,7 @@ { memset(&buffer[bufferLength], 0, 64-bufferLength); computeBlock(&h0,&h1,&h2,&h3,&h4, buffer); - memset(buffer, 0, 48); + memset(buffer, 0, 56); } uint64_t lengthBit = totalBufferLength << 3; @@ -201,7 +201,7 @@ { memset(&buffer[length], 0, 64-length); computeBlock(&h0,&h1,&h2,&h3,&h4, buffer); - memset(buffer, 0, length); + memset(buffer, 0, 56); } uint32_t lengthBitLow = lengthBit;