Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: ES_CW2_Starter_JIN EMBEDDED_CW2 EMBEDDED_CW2_Final Spinnybois ... more
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;
