Closed hazae41 closed 1 year ago
I was trying to decrypt 2246 bytes (Uint8Array) with 12 bytes IV and got the error
chacha20poly1305(key, iv).decrypt(bytes)
RangeError: start offset of Uint32Array should be a multiple of 4
It also happens if I force .slice() to copy to a new buffer
.slice()
chacha20poly1305(key, iv).decrypt(bytes.slice())
Using Stablelib it works fine
new ChaCha20Poly1305(key).open(iv, cipher)
for now either key or iv need to be their own array and now a subarray: chacha20poly1305(key.slice(), iv.slice()) should be a workaround
chacha20poly1305(key.slice(), iv.slice())
Thanks, it works
Fixed
I was trying to decrypt 2246 bytes (Uint8Array) with 12 bytes IV and got the error
It also happens if I force
.slice()
to copy to a new bufferUsing Stablelib it works fine