1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-08-17 06:42:21 +03:00
Files
esp8266/libraries/Hash/examples/sha1.ino
2015-05-20 18:57:42 +02:00

27 lines
497 B
C++

/**
* 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);
}