4 * Compute the SHA256 hash of a message on an ESP8266
11 Serial.println("SHA256 example");
13 /* Create a SHA256 hash */
16 /* Update the hash with your message, as many times as you like */
17 const char *hello = "Hello World";
18 hasher.doUpdate(hello, strlen(hello));
20 /* Update the hash with just a plain string*/
21 hasher.doUpdate("Goodbye World");
23 /* Update the hash with a binary message */
24 byte message[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
25 hasher.doUpdate(message, sizeof(message));
27 /* Compute the final hash */
28 byte hash[SHA256_SIZE];
31 /* hash now contains our 32 byte hash */
32 for (byte i=0; i < SHA256_SIZE; i++)
34 if (hash[i]<0x10) { Serial.print('0'); }
35 Serial.print(hash[i], HEX);