@waku/rln
Version:
RLN (Rate Limiting Nullifier) implementation for Waku
54 lines (43 loc) • 1.07 kB
JavaScript
import { __exports as common } from '../../../../../_virtual/common2.js';
import '../utils.js';
import { __exports as utils$1 } from '../../../../../_virtual/utils3.js';
var utils = utils$1;
var rotr32 = utils.rotr32;
function ft_1(s, x, y, z) {
if (s === 0)
return ch32(x, y, z);
if (s === 1 || s === 3)
return p32(x, y, z);
if (s === 2)
return maj32(x, y, z);
}
common.ft_1 = ft_1;
function ch32(x, y, z) {
return (x & y) ^ ((~x) & z);
}
common.ch32 = ch32;
function maj32(x, y, z) {
return (x & y) ^ (x & z) ^ (y & z);
}
common.maj32 = maj32;
function p32(x, y, z) {
return x ^ y ^ z;
}
common.p32 = p32;
function s0_256(x) {
return rotr32(x, 2) ^ rotr32(x, 13) ^ rotr32(x, 22);
}
common.s0_256 = s0_256;
function s1_256(x) {
return rotr32(x, 6) ^ rotr32(x, 11) ^ rotr32(x, 25);
}
common.s1_256 = s1_256;
function g0_256(x) {
return rotr32(x, 7) ^ rotr32(x, 18) ^ (x >>> 3);
}
common.g0_256 = g0_256;
function g1_256(x) {
return rotr32(x, 17) ^ rotr32(x, 19) ^ (x >>> 10);
}
common.g1_256 = g1_256;
export { common as default };