emn178 / js-sha3

A simple SHA-3 / Keccak hash function for JavaScript supports UTF-8 encoding.
MIT License
350 stars 85 forks source link

Fixes inconsistent comparison for ArrayBuffer #23

Closed liangzan closed 1 year ago

liangzan commented 4 years ago

We faced an issue where the conditional message.constructor === ArrayBuffer behaved inconsistently. When ran from jest, an ArrayBuffer instance returned false, while running the library directly returned true. Using the constructor name and comparing against a string solved the issue.

coveralls commented 4 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling 5ae72e8b495848b5ab648bce65bbb1915449691e on Propine:master into b39d0910cb4cce54a6060c21e1491d55f70269bf on emn178:master.

emn178 commented 1 year ago

I tested in Jest, and it seems works without change. Maybe Jest has fixed this issue.