fix: bug with counter >> 32

This commit is contained in:
Christophe Diederichs 2020-05-08 22:34:41 +02:00
parent 3f7f9d7905
commit b0fcb363e8

View File

@ -112,7 +112,7 @@ function Chacha20 (n, k, counter) {
this.state[12] = counter & 0xffffffff
if (n.byteLength === 8) {
this.state[13] = counter >> 32
this.state[13] = (counter && 0xffffffff00000000) >> 32
this.state[14] = n.readUInt32LE(0)
this.state[15] = n.readUInt32LE(4)
} else {