arduino-libraries / ArduinoBearSSL

Port of BearSSL to Arduino
MIT License
86 stars 49 forks source link

Adding runHash method #35

Closed luigigubello closed 3 years ago

luigigubello commented 4 years ago

Cryptography is cool, but it is hard. I have added the method runHash() because I hope this is a user-friendly way to calculate a hash value. The user needs just to allocate memory for the output, give the input to runHash() and the method returns the output.

How to use

SHA256

runHash()

Giving the input text, this method returns the SHA256 hash.

Sintax

SHA256.runHash(input, inputLength, output);

Parameters

Example

#include <ArduinoBearSSL.h>
uint8_t input[8] = "Arduino";
uint8_t output[32];
void setup() {
  SHA256.runHash(input, 8, output);
}
void loop() {}

(similar for MD5 and SHA1)

aentinger commented 4 years ago

Hi @luigigubello :wave: I know you are probably busy but let's finish this PR up so it can be merged ;)

aentinger commented 3 years ago

Closing this PR due to lack of feedback.