zk-email-light
Version:
ZkEmail only for Header
17 lines • 687 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.SHA_PADDED_MESSAGE_LENGTH = exports.bigintToCircomInputs = void 0;
// circom rsa field expression
// 121 bits * 17 = 2057 bits operation
const RSA_FIELD_BITS = 121;
const RSA_FIELD_LENGTH = 17;
const BIGINT_121_MAX = 2n ** BigInt(RSA_FIELD_BITS) - 1n;
const bigintToCircomInputs = (n) => {
return Array.from({ length: Number(RSA_FIELD_LENGTH) }, (_, i) => {
const remainder = n >> BigInt(i * RSA_FIELD_BITS);
return remainder & BIGINT_121_MAX;
});
};
exports.bigintToCircomInputs = bigintToCircomInputs;
exports.SHA_PADDED_MESSAGE_LENGTH = 640;
//# sourceMappingURL=input.js.map