Hi, I need generate hash of string.
I found this library. For cycle is from this file.
#include <sha1.h>
void setup () { Serial.begin(9600); }
void loop() {
delay(5000);
char tmp[41];
memset(tmp, 0, 41);
Sha1.init();
Sha1.print("abc");
uint8_t *hash = Sha1.result();
for (int i=0; i<20; i++) {
tmp[i*2] = "0123456789abcdef"[hash[i]>>4];
tmp[i*2+1] = "0123456789abcdef"[hash[i]&0xf];
}
Serial.println(tmp);
}
This code send string over RS-232:
a9993e364706816aba3e25717850c26c9cd0d89d
but if I create sha1 hash of the same string on my linux computer I get different hash:
$ echo "abc" | sha1sum
03cfd743661f07975fa2f1220c5194cbaff48451 -
But in documentainon autor wrote it is good.
What I do bad?
I do not need exactly sha1, any other hash (for example md5) is good for me too.