Well, I tried to hash a string, or at least a set of numbers in Python, and compare it to the one that was generated using the MD5 library updated by Scott MacVicar on Arduino, but the results I get are different.
Arduino Code:
#include <MD5.h>
void setup()
{
Serial.begin(9600);
delay(1000);
unsigned char* hash=MD5::make_hash("hello");
char *md5str = MD5::make_digest(hash, 16);
Serial.println(md5str);
}
Result: 5d41402abc4b2a76b9e4080020008c00
Python Code:
from hashlib import md5
m = md5('hello').hexdigest()
print m
Result: 5d41402abc4b2a76b9719d911017c592
From what I see in every attempt, the difference is the sum of the last 14 characters. But the length of the generated hashes is the same!
What am I doing wrong? Thanks
Edit:
I used the command from the terminal and got:
echo -n 'hello' | openssl md5
Result: 5d41402abc4b2a76b9719d911017c592
Which makes me think that the root of the problem is in the arduino code
source
share