emn178 / js-sha3

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

Fix error in arrayBuffer when there are extra bytes #37

Closed iatll closed 11 months ago

iatll commented 11 months ago

Hello, when the number of output bits is large the following occurs:

 h = shake256.create(40);
 h.update("");
 const a = new Uint8Array(h.arrayBuffer());
 a[4]; // 11 as expected

 h = shake256.create(32 * (34 + 1) + 8); 
 h.update("");
 const b = new Uint8Array(h.arrayBuffer());
 a[4]; // 70  but should be 11
emn178 commented 11 months ago

Thanks for reporting