Fork of François Berder Crypto, fixed AES CBC and small rework

Dependents:   AES_example shaun_larada Smartage

Fork of Crypto by Francois Berder

Revision:
5:06cd9c8afa0b
Parent:
4:0da19393bd57
Child:
6:19aa835f2bbb
diff -r 0da19393bd57 -r 06cd9c8afa0b MD5.cpp
--- a/MD5.cpp	Thu Sep 12 10:18:57 2013 +0000
+++ b/MD5.cpp	Thu Sep 12 15:08:51 2013 +0000
@@ -50,7 +50,7 @@
     return 16;
 }
 
-void MD5::add(uint8_t *in, uint32_t length)
+void MD5::update(uint8_t *in, uint32_t length)
 {
     if(length < 64-bufferLength)
     {
@@ -75,7 +75,7 @@
     totalBufferLength += length;
 }
 
-void MD5::computeDigest(uint8_t *digest)
+void MD5::finalize(uint8_t *digest)
 {
     uint16_t padding;
     if(totalBufferLength % 64 < 56)
@@ -90,7 +90,7 @@
     {
         memset(&buffer[bufferLength], 0, 64-bufferLength);
         computeRounds(&a, &b, &c, &d, buffer);
-        memset(buffer, 0, bufferLength);
+        memset(buffer, 0, 56);
     }
     uint64_t lengthBit = totalBufferLength << 3;
     uint32_t lengthBitLow = lengthBit;
@@ -179,7 +179,7 @@
     {
         memset(&buffer[length], 0, 64-length);
         computeRounds(&a, &b, &c, &d, msg);
-        memset(buffer, 0, length);
+        memset(buffer, 0, 56);
     }
 
     uint32_t lengthBitLow = lengthBit;