Skip to content

Instantly share code, notes, and snippets.

@sleepdefic1t
Last active December 22, 2017 05:16
Show Gist options
  • Save sleepdefic1t/f1bab4216c9724306a124365cbe00f93 to your computer and use it in GitHub Desktop.
Save sleepdefic1t/f1bab4216c9724306a124365cbe00f93 to your computer and use it in GitHub Desktop.

Ark Crypto Arduino Step 1

required libs

ESP8266 Crypto https://github.com/intrbiz/arduino-crypto
#include <Crypto.h>

/*
 * secret:  "bullet parade snow bacon mutual deposit brass floor staff list concert ask"
 * returns: "950981CE17DF662DBC1D25305F8597A71309FB8F7232203A0944477E2534B021"
 */

void sha256From(const char *secret)
{
  SHA256 hasher;
  hasher.doUpdate(secret);

  byte hash[SHA256_SIZE];
  hasher.doFinal(hash);

  for (byte i = 0; i < SHA256_SIZE; i++) {
    if (hash[i] < 0x10)
      Serial.print('0');
    Serial.print(hash[i], HEX);
  }
}

void setup()
{
  Serial.begin(115200);

  const char *secret = "bullet parade snow bacon mutual deposit brass floor staff list concert ask";
  sha256From(secret);
}

void loop() {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment