Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <crypto.h>
- int led = 13;
- //char * key = "0123456789012345678901234567890123456789012345678901234567890123"; //64 bytes
- uint8_t * key = (uint8_t *) "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C"
- "\x0D\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19"
- "\x1A\x1B\x1C\x1D\x1E\x1F !\"#$%&'()*+,-./0123456789:"
- ";<=>?";
- hmac_sha1_ctx_t hctx;
- uint8_t mac[20];
- // the setup routine runs once when you press reset:
- void setup() {
- // initialize the digital pin as an output.
- pinMode(led, OUTPUT);
- hmac_sha1_init(&hctx, key, 512);
- hmac_sha1_lastBlock(&hctx, "Sample #1", 72);
- hmac_sha1_final(mac, &hctx);
- Serial.begin(9600);
- while(!Serial);
- Serial.println("Hohohoho");
- }
- // the loop routine runs over and over again forever:
- void loop() {
- digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
- delay(1000); // wait for a second
- digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
- delay(1000); // wait for a second
- for(int c=0; c<20; c++){
- Serial.print("0x");
- Serial.print(mac[c], HEX);
- Serial.print(" ");
- }
- Serial.println("");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement