a338ae9f9d
* Detach buffers by sending to an empty message channel * Move helpers out * fix import * export helpers * Try browser testing * messagechannel check * xvfb-run --auto-servernum npm run test-browser fails weirdly on ci, removing Co-authored-by: Mathias Buus <mathiasbuus@gmail.com>
25 lines
499 B
JavaScript
25 lines
499 B
JavaScript
/* eslint-disable camelcase */
|
|
module.exports = {
|
|
crypto_verify_16,
|
|
crypto_verify_32
|
|
}
|
|
|
|
function vn (x, xi, y, yi, n) {
|
|
var d = 0
|
|
for (let i = 0; i < n; i++) d |= x[xi + i] ^ y[yi + i]
|
|
return (1 & ((d - 1) >>> 8)) - 1
|
|
}
|
|
|
|
// Make non enumerable as this is an internal function
|
|
Object.defineProperty(module.exports, 'vn', {
|
|
value: vn
|
|
})
|
|
|
|
function crypto_verify_16 (x, xi, y, yi) {
|
|
return vn(x, xi, y, yi, 16)
|
|
}
|
|
|
|
function crypto_verify_32 (x, xi, y, yi) {
|
|
return vn(x, xi, y, yi, 32)
|
|
}
|