Crypto.digestStringAsync producing unexpected results

Hey Exponauts,

I’ve been trying to implement the HMAC-SHA-1 algorithm (as described in IETF’s RFC 2104) using Crypto.digestStringAsync for computing two intermediary SHA-1 digests, but I’ve been getting unexpected results.

In order to verify that the SHA-1 digest is computed correctly, I used some of the NIST SHA-1 test vectors, and that’s when I got mixed results. The SHA-1 digest was computed correctly for some test cases, but incorrectly for others.

Here’s a simple demo if you’d like to check out a reproduction of the issue.

Am I doing something wrong? I’ve been stuck on this for days, so your help is much appreciated!

Thanks a bunch for the Expo team for implementing the Crypto package, and for all their outstanding efforts! :clap:

Any pointers would be very much appreciated! :pray:

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.