espruino / EspruinoDocs

See http://espruino.com for the complete Espruino Documentation - many links in this repository will not work
http://www.espruino.com/
Other
253 stars 282 forks source link

add new modue hmac256 #728

Closed MaBecker closed 2 months ago

MaBecker commented 2 months ago

based on hmac

gfwilliams commented 2 months ago

Thanks! But wasn't it possible just to add this single function to HMAC?

exports.SHA256 = function(key) {
  return new exports.HMAC(key, require('crypto').SHA256, 64, 32);
};

Or was there something else?

MaBecker commented 2 months ago

Wow, ok looks like have been way much over motivated..... Sure why not, just one file. What happens if require('crypto').SHA256 failes because sha256 is not available?

gfwilliams commented 2 months ago

Sorry! Well, it'll only fail when the function is executed - there's no problem with it being in there and SHA256 not being supported if it's not used.

MaBecker commented 2 months ago

please check again.

gfwilliams commented 2 months ago

Looks great - thanks for doing that!