1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-07-27 18:02:17 +03:00

add Hash library currently supports SHA1

This commit is contained in:
Markus Sattler
2015-05-20 18:57:42 +02:00
parent 605e76fb1b
commit 661c7075b7
6 changed files with 378 additions and 0 deletions

View File

@ -0,0 +1,26 @@
/**
* simple demo to show sha1 calculation
*/
#include <Arduino.h>
#include <hash.h>
void setup() {
Serial.begin(921600);
}
void loop() {
uint8_t hash[20];
const uint8_t test[] = "test";
sha1((uint8_t *)&test[0], sizeof(test)-1, &hash[0]);
// SHA1: A94A8FE5CCB19BA61C4C0873D391E987982FBBD3
Serial.print("SHA1:");
for(uint16_t i = 0; i < 20; i++) {
Serial.printf("%02X", hash[i]);
}
Serial.println();
delay(1000);
}