+3
| Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. | ||
| THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
+17
| # @libn/ecc | ||
| Curve25519 key exchange and digital signatures. | ||
| ```sh | ||
| deno add jsr:@libn/ecc | ||
| npm install @libn/aead | ||
| npx jsr add @libn/aead | ||
| bun add @libn/aead | ||
| bunx jsr add @libn/aead | ||
| ``` | ||
| - [RFC 7748](https://www.rfc-editor.org/rfc/rfc7748) | ||
| - [RFC 8032](https://www.rfc-editor.org/rfc/rfc8032) | ||
| - [noble-ed25519](https://github.com/paulmillr/noble-ed25519) |
| /** | ||
| * Edwards-curve digital signatures over Curve25519. | ||
| * | ||
| * @example Key generation, signing, verification | ||
| * ```ts | ||
| * import { assert } from "@std/assert"; | ||
| * | ||
| * const message = crypto.getRandomValues(new Uint8Array(100)); | ||
| * | ||
| * // Only you know this value | ||
| * const secretKey = crypto.getRandomValues(new Uint8Array(32)); | ||
| * | ||
| * // So only you can make this signature | ||
| * const signature = sign(secretKey, message); | ||
| * | ||
| * // Share your public key to prove it | ||
| * const publicKey = generate(secretKey); | ||
| * assert(verify(publicKey, message, signature)); | ||
| * ``` | ||
| * | ||
| * @module ed25519 | ||
| */ | ||
| /** Derives an Ed25519 public key from a secret key. */ | ||
| export declare const generate: ($: Uint8Array) => Uint8Array<ArrayBuffer>; | ||
| /** Creates an Ed25519 digital signature. */ | ||
| export declare const sign: (secretKey: Uint8Array, message: Uint8Array) => Uint8Array<ArrayBuffer>; | ||
| /** Verifies a message's Ed25519 signature. */ | ||
| export declare const verify: (publicKey: Uint8Array, message: Uint8Array, signature: Uint8Array) => null | boolean; |
| "use strict"; | ||
| /** | ||
| * Edwards-curve digital signatures over Curve25519. | ||
| * | ||
| * @example Key generation, signing, verification | ||
| * ```ts | ||
| * import { assert } from "@std/assert"; | ||
| * | ||
| * const message = crypto.getRandomValues(new Uint8Array(100)); | ||
| * | ||
| * // Only you know this value | ||
| * const secretKey = crypto.getRandomValues(new Uint8Array(32)); | ||
| * | ||
| * // So only you can make this signature | ||
| * const signature = sign(secretKey, message); | ||
| * | ||
| * // Share your public key to prove it | ||
| * const publicKey = generate(secretKey); | ||
| * assert(verify(publicKey, message, signature)); | ||
| * ``` | ||
| * | ||
| * @module ed25519 | ||
| */ | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.verify = exports.sign = exports.generate = void 0; | ||
| const sha2_js_1 = require("../hash/sha2.js"); | ||
| const lib_js_1 = require("./lib.js"); | ||
| const int = ($) => { | ||
| const a = (0, sha2_js_1.sha512)($); | ||
| return ((0, lib_js_1.enBig)(a) | (0, lib_js_1.enBig)(a.subarray(32)) << 256n) % lib_js_1.N; | ||
| }; | ||
| /** Derives an Ed25519 public key from a secret key. */ | ||
| const generate = ($) => (0, lib_js_1.enPoint)((0, lib_js_1.enBig)((0, lib_js_1.prune)($))); | ||
| exports.generate = generate; | ||
| /** Creates an Ed25519 digital signature. */ | ||
| const sign = (secretKey, message) => { | ||
| const a = (0, lib_js_1.prune)(secretKey), b = new Uint8Array(message.length + 64); | ||
| b.set(a.subarray(32)), b.set(message, 32); | ||
| const c = (0, lib_js_1.enBig)(a), d = int(b.subarray(0, -32)); | ||
| a.set((0, lib_js_1.enPoint)(d)), b.set(a), b.set((0, lib_js_1.enPoint)(c), 32), b.set(message, 64); | ||
| return a.set((0, lib_js_1.deBig)((d + c * int(b) % lib_js_1.N) % lib_js_1.N), 32), a; | ||
| }; | ||
| exports.sign = sign; | ||
| /** Verifies a message's Ed25519 signature. */ | ||
| const verify = (publicKey, message, signature) => { | ||
| if (signature.length !== 64) | ||
| return false; | ||
| const a = (0, lib_js_1.enBig)(signature.subarray(32)); | ||
| if (a >= lib_js_1.N) | ||
| return false; | ||
| const b = new Uint8Array(message.length + 64); | ||
| b.set(signature), b.set(publicKey, 32), b.set(message, 64); | ||
| let c = (0, lib_js_1.dePoint)(publicKey); | ||
| if (c < 0n) | ||
| return false; | ||
| let d = int(b), e = lib_js_1.I; | ||
| // No secret information involved, so unsafe double-and-add is ok. | ||
| do | ||
| if (d & 1n) | ||
| e = (0, lib_js_1.add)(e, c); | ||
| while (c = (0, lib_js_1.double)(c), d >>= 1n); | ||
| c = (0, lib_js_1.dePoint)(signature); | ||
| return c >= 0n && (0, lib_js_1.equals)((0, lib_js_1.wnaf)(a).a, (0, lib_js_1.add)(e, c)); | ||
| }; | ||
| exports.verify = verify; |
| /** Clears and sets bits. */ | ||
| export declare const prune: ($: Uint8Array) => Uint8Array<ArrayBuffer>; | ||
| /** Encodes binary to a bigint. */ | ||
| export declare const enBig: ($: Uint8Array) => bigint; | ||
| /** Decodes a bigint to binary. */ | ||
| export declare const deBig: ($: bigint) => Uint8Array<ArrayBuffer>; | ||
| /** Curve25519 prime. */ | ||
| export declare const P: bigint; | ||
| /** Curve25519 order. */ | ||
| export declare const N: bigint; | ||
| /** Reduces modulo P. */ | ||
| export declare const mod: ($: bigint) => bigint; | ||
| /** Raises to a power modulo P. */ | ||
| export declare const pow: (base: bigint, power: number, multiplier?: bigint) => bigint; | ||
| /** Inverts modulo P. */ | ||
| export declare const inv: ($: bigint) => bigint; | ||
| /** Common exponentiation. */ | ||
| export declare const exp: (base: bigint, cube?: bigint) => bigint; | ||
| /** Identity point. */ | ||
| export declare const I: bigint; | ||
| /** Adds two points. */ | ||
| export declare const add: (one: bigint, two: bigint) => bigint; | ||
| /** Doubles a point. */ | ||
| export declare const double: ($: bigint) => bigint; | ||
| /** Multiplies the base point by a scalar. */ | ||
| export declare const wnaf: ($: bigint) => { | ||
| a: bigint; | ||
| _: bigint; | ||
| }; | ||
| /** Encodes a point (derived from scalar) to binary. */ | ||
| export declare const enPoint: ($: bigint) => Uint8Array<ArrayBuffer>; | ||
| /** Decodes binary to a point, or -1 if invalid. */ | ||
| export declare const dePoint: ($: Uint8Array) => bigint; | ||
| /** Compares two points. */ | ||
| export declare const equals: (one: bigint, two: bigint) => boolean; |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.equals = exports.dePoint = exports.enPoint = exports.wnaf = exports.double = exports.add = exports.I = exports.exp = exports.inv = exports.pow = exports.mod = exports.N = exports.P = exports.deBig = exports.enBig = exports.prune = void 0; | ||
| const sha2_js_1 = require("../hash/sha2.js"); | ||
| /** Clears and sets bits. */ | ||
| const prune = ($) => { | ||
| const a = (0, sha2_js_1.sha512)($.subarray(0, 32)); | ||
| // Only clamp the lower half, upper is treated as a scalar (or unused). | ||
| return a[0] &= 248, a[31] = a[31] & 127 | 64, a; | ||
| }; | ||
| exports.prune = prune; | ||
| /** Encodes binary to a bigint. */ | ||
| const enBig = ($) => { | ||
| const a = new DataView($.buffer, $.byteOffset); | ||
| return a.getBigUint64(0, true) | a.getBigUint64(8, true) << 64n | | ||
| a.getBigUint64(16, true) << 128n | a.getBigUint64(24, true) << 192n; | ||
| }; | ||
| exports.enBig = enBig; | ||
| /** Decodes a bigint to binary. */ | ||
| const deBig = ($) => { | ||
| const a = new Uint8Array(32), b = new DataView(a.buffer, a.byteOffset); | ||
| b.setBigUint64(24, $ >> 192n, true), b.setBigUint64(16, $ >> 128n, true); | ||
| return b.setBigUint64(8, $ >> 64n, true), b.setBigUint64(0, $, true), a; | ||
| }; | ||
| exports.deBig = deBig; | ||
| /** Curve25519 prime. */ | ||
| exports.P = (() => (1n << 255n) - 19n)(); | ||
| /** Curve25519 order. */ | ||
| exports.N = (() => 1n << 252n | 0x14def9dea2f79cd65812631a5cf5d3edn)(); | ||
| /** Reduces modulo P. */ | ||
| const mod = ($) => ($ %= exports.P) < 0n ? $ + exports.P : $; | ||
| exports.mod = mod; | ||
| /** Raises to a power modulo P. */ | ||
| const pow = (base, power, multiplier = base) => { | ||
| do | ||
| base = base * base % exports.P; | ||
| while (--power); // use `% P` to avoid bigint limit | ||
| return base * multiplier % exports.P; | ||
| }; | ||
| exports.pow = pow; | ||
| /** Inverts modulo P. */ | ||
| const inv = ($) => { | ||
| let a = 0n, b = (0, exports.mod)($), c = exports.P, d = 1n, e = 0n, f, g; | ||
| while (f = b) | ||
| b = c % f, c /= f, g = a - c * d, a = d, d = g, e *= ~c, c = f; | ||
| return (0, exports.mod)(a); | ||
| }; | ||
| exports.inv = inv; | ||
| /** Common exponentiation. */ | ||
| const exp = (base, cube = base ** 3n) => { | ||
| const a = (0, exports.pow)(cube ** 10n % exports.P * base % exports.P, 5); | ||
| const b = (0, exports.pow)((0, exports.pow)((0, exports.pow)(a, 10), 20), 40); | ||
| return (0, exports.pow)((0, exports.pow)((0, exports.pow)(b, 80), 80, b), 10, a) ** 4n % exports.P * base % exports.P; | ||
| }; | ||
| exports.exp = exp; | ||
| const D = 0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3n; | ||
| const R = 0x2b8324804fc1df0b2b4d00993dfbd7a72f431806ad2fe478c4ee1b274a0ea0b0n; | ||
| const X = 0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51an; | ||
| const Y = 0x6666666666666666666666666666666666666666666666666666666666666658n; | ||
| // An extended point with 256-bit coordinates `(X, Y, Z, T)` is a 1024-bit | ||
| // integer `X | Y << 256n | Z << 512n | T << 768n`. | ||
| const Z1 = /* @__PURE__ */ (() => 1n << 512n)(); | ||
| const MX = /* @__PURE__ */ (() => (1n << 256n) - 1n)(); | ||
| /** Identity point. */ | ||
| exports.I = (() => Z1 | 1n << 256n)(); | ||
| /** Adds two points. */ | ||
| const add = (one, two) => { | ||
| const a = one & MX, b = one >> 256n & MX, c = two & MX, d = two >> 256n & MX; | ||
| const e = (one >> 512n & MX) * (two >> 512n & MX) % exports.P; | ||
| const f = (one >> 768n) * D * (two >> 768n) % exports.P, g = e + f; | ||
| const h = e - f, i = a * c % exports.P + b * d % exports.P, j = (a + b) * (c + d) % exports.P - i; | ||
| return (0, exports.mod)(h * j) | (0, exports.mod)(i * g) << 256n | (0, exports.mod)(g * h) << 512n | | ||
| (0, exports.mod)(i * j) << 768n; | ||
| }; | ||
| exports.add = add; | ||
| /** Doubles a point. */ | ||
| const double = ($) => { | ||
| const a = $ & MX, b = $ >> 256n & MX, c = $ >> 512n & MX, d = a ** 2n % exports.P; | ||
| const e = exports.P - d, f = b ** 2n % exports.P, g = e + f, h = e - f; | ||
| const i = g - (c * c % exports.P << 1n) % exports.P, j = (a + b) ** 2n % exports.P - d - f; | ||
| return (0, exports.mod)(i * j) | (0, exports.mod)(g * h) << 256n | (0, exports.mod)(g * i) << 512n | | ||
| (0, exports.mod)(h * j) << 768n; | ||
| }; | ||
| exports.double = double; | ||
| const G = /* @__PURE__ */ (() => { | ||
| const a = Array(4224); | ||
| let b = X | Y << 256n | Z1 | X * Y % exports.P << 768n, c, z = 0, y; | ||
| do { | ||
| y = 0, a[z++] = c = b; | ||
| do | ||
| a[z++] = c = (0, exports.add)(c, b); | ||
| while (++y < 127); | ||
| b = (0, exports.double)(c); | ||
| } while (z < 4224); | ||
| return a; | ||
| })(); | ||
| /** Multiplies the base point by a scalar. */ | ||
| const wnaf = ($) => { | ||
| let a = exports.I, b = X | Y << 256n | Z1 | X * Y % exports.P << 768n, c, d, e, z = 0; | ||
| do | ||
| c = Number($ & 255n), | ||
| $ >>= 8n, | ||
| c > 128 && (c -= 256, ++$), | ||
| d = G[(z << 7) + (c + (c >> 31) ^ (c >> 31)) - (c ? 1 : 0)], | ||
| e = exports.P - (d & MX) | d & (MX << 256n | MX << 512n) | exports.P - (d >> 768n) << 768n, | ||
| c ? a = (0, exports.add)(a, c < 0 ? e : d) : b = (0, exports.add)(b, z & 1 ? e : d); | ||
| while (++z < 33); | ||
| return { a, _: b }; | ||
| }; | ||
| exports.wnaf = wnaf; | ||
| /** Encodes a point (derived from scalar) to binary. */ | ||
| const enPoint = ($) => { | ||
| const { a, _: _ } = (0, exports.wnaf)($), b = (0, exports.inv)(a >> 512n & MX); | ||
| const c = (0, exports.deBig)((0, exports.mod)((a >> 256n & MX) * b)); | ||
| return (a & MX) * b % exports.P & 1n && (c[31] |= 128), c; | ||
| }; | ||
| exports.enPoint = enPoint; | ||
| /** Decodes binary to a point, or -1 if invalid. */ | ||
| const dePoint = ($) => { | ||
| const a = $[31] >> 7, b = (0, exports.enBig)($) & ~(1n << 255n), c = b * b % exports.P; | ||
| const d = (0, exports.mod)(c - 1n), e = c * D + 1n, f = e ** 3n % exports.P; | ||
| let g = (0, exports.exp)(d * e * f * f % exports.P) * d * f % exports.P; | ||
| switch (e * g * g % exports.P) { | ||
| case exports.P - d: | ||
| g = g * R % exports.P; // falls through | ||
| case d: | ||
| if (!a || g) { | ||
| if (Number(g & 1n) ^ a) | ||
| g = exports.P - g; | ||
| return g | b << 256n | Z1 | g * b % exports.P << 768n; | ||
| } | ||
| } | ||
| return -1n; | ||
| }; | ||
| exports.dePoint = dePoint; | ||
| /** Compares two points. */ | ||
| const equals = (one, two) => { | ||
| const t1 = one >> 512n & MX, t2 = two >> 512n & MX; | ||
| return !((0, exports.mod)((one & MX) * t2) ^ (0, exports.mod)(t1 * (two & MX)) | | ||
| (0, exports.mod)((one >> 256n & MX) * t2) ^ (0, exports.mod)(t1 * (two >> 256n & MX))); | ||
| }; | ||
| exports.equals = equals; |
| /** | ||
| * Elliptic-curve Diffie-Hellman over Curve25519. | ||
| * | ||
| * @example Key exchange | ||
| * ```ts | ||
| * import { assertEquals } from "@std/assert"; | ||
| * | ||
| * // Alice has a secret key | ||
| * const secretKeyA = crypto.getRandomValues(new Uint8Array(32)); | ||
| * | ||
| * // Bob has a secret key | ||
| * const secretKeyB = crypto.getRandomValues(new Uint8Array(32)); | ||
| * | ||
| * // They share their public keys | ||
| * const publicKeyA = derive(secretKeyA); // A sends to B | ||
| * const publicKeyB = derive(secretKeyB); // B sends to A | ||
| * | ||
| * // And agree on a shared secret | ||
| * const sharedAB = exchange(secretKeyA, publicKeyB); | ||
| * const sharedBA = exchange(secretKeyB, publicKeyA); | ||
| * assertEquals(sharedAB, sharedBA); | ||
| * ``` | ||
| * | ||
| * @module x25519 | ||
| */ | ||
| /** Multiplies a private scalar and a public point. */ | ||
| export declare const ladder: (scalar: bigint, point: bigint) => bigint; | ||
| /** Derives an X25519 public key. */ | ||
| export declare const derive: (secret_key: Uint8Array) => Uint8Array<ArrayBuffer>; | ||
| /** Derives a not-all-zero shared secret from two Montgomery-curve keys. */ | ||
| export declare const exchange: (secret_key: Uint8Array, public_key: Uint8Array) => Uint8Array<ArrayBuffer> | null; | ||
| /** Converts an Ed25519 secret key to its X25519 equivalent. */ | ||
| export declare const convertSecret: ($: Uint8Array) => Uint8Array<ArrayBuffer>; | ||
| /** Converts an Ed25519 public key to its X25519 equivalent. */ | ||
| export declare const convertPublic: ($: Uint8Array) => Uint8Array<ArrayBuffer>; |
| "use strict"; | ||
| /** | ||
| * Elliptic-curve Diffie-Hellman over Curve25519. | ||
| * | ||
| * @example Key exchange | ||
| * ```ts | ||
| * import { assertEquals } from "@std/assert"; | ||
| * | ||
| * // Alice has a secret key | ||
| * const secretKeyA = crypto.getRandomValues(new Uint8Array(32)); | ||
| * | ||
| * // Bob has a secret key | ||
| * const secretKeyB = crypto.getRandomValues(new Uint8Array(32)); | ||
| * | ||
| * // They share their public keys | ||
| * const publicKeyA = derive(secretKeyA); // A sends to B | ||
| * const publicKeyB = derive(secretKeyB); // B sends to A | ||
| * | ||
| * // And agree on a shared secret | ||
| * const sharedAB = exchange(secretKeyA, publicKeyB); | ||
| * const sharedBA = exchange(secretKeyB, publicKeyA); | ||
| * assertEquals(sharedAB, sharedBA); | ||
| * ``` | ||
| * | ||
| * @module x25519 | ||
| */ | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.convertPublic = exports.convertSecret = exports.exchange = exports.derive = exports.ladder = void 0; | ||
| const lib_js_1 = require("./lib.js"); | ||
| const F = /* @__PURE__ */ (() => ~(1n << 255n))(); // clears unused top bit | ||
| /** Multiplies a private scalar and a public point. */ | ||
| const ladder = (scalar, point) => { | ||
| // Clamping in bigint form isn't as efficient, but doesn't mutate passed-in | ||
| // key buffers. | ||
| scalar = scalar & ~7n & F | 1n << 254n, point = point & F; | ||
| let a = 1n, b = 0n, c = point, d = 1n, e = 0n, f, g, z = 254n; // t = bits - 1 | ||
| do | ||
| e ^= f = scalar >> z & 1n, | ||
| a ^= g = (a ^ c) & -e, | ||
| c ^= g, | ||
| d ^= g = (b ^ d) & -e, | ||
| a -= b ^= g, | ||
| b += a + b, | ||
| e = f, | ||
| f = a * (c + d) % lib_js_1.P, | ||
| g = b * (c - d) % lib_js_1.P, | ||
| c = (g + f) ** 2n % lib_js_1.P, | ||
| d = (g - f) ** 2n % lib_js_1.P * point % lib_js_1.P, | ||
| a = a * a % lib_js_1.P, | ||
| b = b * b % lib_js_1.P, | ||
| f = b - a, | ||
| a = a * b % lib_js_1.P, | ||
| b = f * (b + f * 121665n % lib_js_1.P) % lib_js_1.P; | ||
| while (z--); | ||
| // Final cswap is outside the loop. | ||
| return (0, lib_js_1.mod)((0, lib_js_1.pow)((0, lib_js_1.exp)(b ^= (b ^ d) & -e, b **= 3n), 3, a ^ (a ^ c) & -e) * b); | ||
| }; | ||
| exports.ladder = ladder; | ||
| /** Derives an X25519 public key. */ | ||
| const derive = (secret_key) => (0, lib_js_1.deBig)((0, exports.ladder)((0, lib_js_1.enBig)(secret_key), 9n) & F); | ||
| exports.derive = derive; | ||
| /** Derives a not-all-zero shared secret from two Montgomery-curve keys. */ | ||
| const exchange = (secret_key, public_key) => { | ||
| const shared = (0, lib_js_1.deBig)((0, exports.ladder)((0, lib_js_1.enBig)(secret_key), (0, lib_js_1.enBig)(public_key)) & F); | ||
| let byte = 0; | ||
| for (let z = 0; z < 32; ++z) | ||
| byte |= shared[z]; | ||
| return byte ? shared : null; | ||
| }; | ||
| exports.exchange = exchange; | ||
| /** Converts an Ed25519 secret key to its X25519 equivalent. */ | ||
| const convertSecret = ($) => new Uint8Array((0, lib_js_1.prune)($).subarray(0, 32)); | ||
| exports.convertSecret = convertSecret; | ||
| /** Converts an Ed25519 public key to its X25519 equivalent. */ | ||
| const convertPublic = ($) => { | ||
| const a = (0, lib_js_1.enBig)($) & F; | ||
| return (0, lib_js_1.deBig)((0, lib_js_1.mod)((1n + a) * (0, lib_js_1.inv)(1n - a)) & F); | ||
| }; | ||
| exports.convertPublic = convertPublic; |
| /** Hash function (with parameter names from tuple). */ | ||
| export type Hash<A extends any[] = []> = (..._: A) => Uint8Array<ArrayBuffer>; | ||
| /** Parses a base16-encoded initialization vector into 32-bit words. */ | ||
| export declare const iv: (hex: string) => Uint32Array<ArrayBuffer>; | ||
| /** Parses a base16-encoded permutation table into 8-bit words. */ | ||
| export declare const perm: (hex: string | string[], shift?: number) => Uint8Array<ArrayBuffer>; | ||
| /** @internal */ | ||
| interface Pair<A> { | ||
| hi: A; | ||
| lo: A; | ||
| } | ||
| /** 64-bit integer represented as its 32-bit halves. */ | ||
| export interface Integer extends Pair<number> { | ||
| } | ||
| /** Converts a bigint to an integer. */ | ||
| export declare const enInteger: ($: bigint) => Integer; | ||
| /** Converts an integer to a bigint. */ | ||
| export declare const deInteger: ($: Integer) => bigint; | ||
| /** Multiplies two 32-bit integers to a 64-bit product. */ | ||
| export declare const mul64: (one: number, two: number) => Integer; | ||
| /** Adds two 64-bit integers and updates the first in place. */ | ||
| export declare const add128: (one: Integer, two: Integer) => void; | ||
| /** Multiplies two 64-bit integers to a 128-bit product and updates in place. */ | ||
| export declare const mul128: (one: Integer, two: Integer) => void; | ||
| export {}; |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.mul128 = exports.add128 = exports.mul64 = exports.deInteger = exports.enInteger = exports.perm = exports.iv = void 0; | ||
| /** Parses a base16-encoded initialization vector into 32-bit words. */ | ||
| const iv = (hex) => Uint32Array.from(hex.match(/.{8}/g), ($) => parseInt($, 16)); | ||
| exports.iv = iv; | ||
| /** Parses a base16-encoded permutation table into 8-bit words. */ | ||
| const perm = (hex, shift) => Uint8Array.from(hex, ($) => parseInt($, 16) << shift); | ||
| exports.perm = perm; | ||
| /** Converts a bigint to an integer. */ | ||
| const enInteger = ($) => ({ hi: Number($ >> 32n) >>> 0, lo: Number($ & 0xffffffffn) >>> 0 }); | ||
| exports.enInteger = enInteger; | ||
| /** Converts an integer to a bigint. */ | ||
| const deInteger = ($) => BigInt($.hi >>> 0) << 32n | BigInt($.lo >>> 0); | ||
| exports.deInteger = deInteger; | ||
| /** Multiplies two 32-bit integers to a 64-bit product. */ | ||
| const mul64 = (one, two) => { | ||
| const a = one & 0xffff, b = one >>> 16, c = two & 0xffff, d = two >>> 16; | ||
| const e = a * c, f = b * c, g = (e >>> 16) + (f & 0xffff) + a * d; | ||
| return { hi: (f >>> 16) + (g >>> 16) + b * d, lo: g << 16 | e & 0xffff }; | ||
| }; | ||
| exports.mul64 = mul64; | ||
| /** Adds two 64-bit integers and updates the first in place. */ | ||
| const add128 = (one, two) => { | ||
| const temp = (one.lo >>> 0) + (two.lo >>> 0); | ||
| one.hi = (one.hi >>> 0) + (two.hi >>> 0) + (temp / 0x100000000 | 0) | 0; | ||
| one.lo = temp | 0; | ||
| }; | ||
| exports.add128 = add128; | ||
| /** Multiplies two 64-bit integers to a 128-bit product and updates in place. */ | ||
| const mul128 = (one, two) => { | ||
| const a = one.lo >>> 0, b = one.hi >>> 0, c = two.lo >>> 0, d = two.hi >>> 0; | ||
| const e = (0, exports.mul64)(a, c), f = (0, exports.mul64)(b, c), g = (0, exports.mul64)(a, d), h = (0, exports.mul64)(b, d); | ||
| (0, exports.add128)(g, { hi: 0, lo: f.lo }), (0, exports.add128)(g, { hi: 0, lo: e.hi }); | ||
| (0, exports.add128)(h, { hi: 0, lo: f.hi }), (0, exports.add128)(h, { hi: 0, lo: g.hi }); | ||
| two.hi = h.hi, two.lo = h.lo, one.hi = g.lo, one.lo = e.lo; | ||
| }; | ||
| exports.mul128 = mul128; |
| /** | ||
| * [SHA-2](https://www.rfc-editor.org/rfc/rfc6234) hash functions. | ||
| * | ||
| * @example Usage | ||
| * ```ts | ||
| * import { assertEquals } from "@std/assert"; | ||
| * import { crypto } from "@std/crypto"; | ||
| * | ||
| * const data = crypto.getRandomValues(new Uint8Array(100)); | ||
| * assertEquals( | ||
| * sha224(data), | ||
| * new Uint8Array(await crypto.subtle.digest("SHA-224", data)), | ||
| * ); | ||
| * assertEquals( | ||
| * sha256(data), | ||
| * new Uint8Array(await crypto.subtle.digest("SHA-256", data)), | ||
| * ); | ||
| * assertEquals( | ||
| * sha384(data), | ||
| * new Uint8Array(await crypto.subtle.digest("SHA-384", data)), | ||
| * ); | ||
| * assertEquals( | ||
| * sha512(data), | ||
| * new Uint8Array(await crypto.subtle.digest("SHA-512", data)), | ||
| * ); | ||
| * ``` | ||
| * | ||
| * @module sha2 | ||
| */ | ||
| import { type Hash } from "./lib.js"; | ||
| /** Hashes with SHA-224. */ | ||
| export declare const sha224: Hash<[$: Uint8Array]>; | ||
| /** Hashes with SHA-256. */ | ||
| export declare const sha256: Hash<[$: Uint8Array]>; | ||
| /** Hashes with SHA-384. */ | ||
| export declare const sha384: Hash<[$: Uint8Array]>; | ||
| /** Hashes with SHA-512. */ | ||
| export declare const sha512: Hash<[$: Uint8Array]>; |
| "use strict"; | ||
| /** | ||
| * [SHA-2](https://www.rfc-editor.org/rfc/rfc6234) hash functions. | ||
| * | ||
| * @example Usage | ||
| * ```ts | ||
| * import { assertEquals } from "@std/assert"; | ||
| * import { crypto } from "@std/crypto"; | ||
| * | ||
| * const data = crypto.getRandomValues(new Uint8Array(100)); | ||
| * assertEquals( | ||
| * sha224(data), | ||
| * new Uint8Array(await crypto.subtle.digest("SHA-224", data)), | ||
| * ); | ||
| * assertEquals( | ||
| * sha256(data), | ||
| * new Uint8Array(await crypto.subtle.digest("SHA-256", data)), | ||
| * ); | ||
| * assertEquals( | ||
| * sha384(data), | ||
| * new Uint8Array(await crypto.subtle.digest("SHA-384", data)), | ||
| * ); | ||
| * assertEquals( | ||
| * sha512(data), | ||
| * new Uint8Array(await crypto.subtle.digest("SHA-512", data)), | ||
| * ); | ||
| * ``` | ||
| * | ||
| * @module sha2 | ||
| */ | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.sha512 = exports.sha384 = exports.sha256 = exports.sha224 = void 0; | ||
| const lib_js_1 = require("./lib.js"); | ||
| const STATE = /* @__PURE__ */ new Uint32Array(16); | ||
| const BLOCK = /* @__PURE__ */ new Uint8Array(128); | ||
| const VIEW = /* @__PURE__ */ (() => new DataView(BLOCK.buffer))(); | ||
| const md = (initial, mix, length, $) => { | ||
| const size = initial.length << 3, max = $.length & -size; | ||
| STATE.set(initial); | ||
| let view = new DataView($.buffer, $.byteOffset), z = 0, y = 0; | ||
| while (z !== max) | ||
| mix(view, z), z += size; | ||
| if (max !== $.length) | ||
| y = $.length - z, BLOCK.set($.subarray(z)); | ||
| view = VIEW, BLOCK[y] = 128, size - ++y < size >> 3 && mix(view, y = 0); | ||
| BLOCK.fill(0, y), view.setBigUint64(size - 8, BigInt($.length) << 3n); | ||
| mix(view, 0), z = length; | ||
| do | ||
| view.setUint32(z -= 4, STATE[z >> 2]); | ||
| while (z); | ||
| const out = new Uint8Array(BLOCK.subarray(0, length)); | ||
| return STATE.fill(0), BLOCK.fill(0), out; | ||
| }; | ||
| const W64 = /* @__PURE__ */ new Uint32Array(64); | ||
| const K64 = /* @__PURE__ */ (0, lib_js_1.iv)("428a2f9871374491b5c0fbcfe9b5dba53956c25b59f111f1923f82a4ab1c5ed5d807aa9812835b01243185be550c7dc372be5d7480deb1fe9bdc06a7c19bf174e49b69c1efbe47860fc19dc6240ca1cc2de92c6f4a7484aa5cb0a9dc76f988da983e5152a831c66db00327c8bf597fc7c6e00bf3d5a7914706ca63511429296727b70a852e1b21384d2c6dfc53380d13650a7354766a0abb81c2c92e92722c85a2bfe8a1a81a664bc24b8b70c76c51a3d192e819d6990624f40e3585106aa07019a4c1161e376c082748774c34b0bcb5391c0cb34ed8aa4a5b9cca4f682e6ff3748f82ee78a5636f84c878148cc7020890befffaa4506cebbef9a3f7c67178f2"); | ||
| const mix64 = (block, at) => { | ||
| let a, b, z = 0; | ||
| do | ||
| W64[z] = block.getUint32(at), at += 4; | ||
| while (++z < 16); | ||
| do | ||
| a = W64[z - 2], | ||
| b = W64[z - 15], | ||
| W64[z] = ((b >>> 7 | b << 25) ^ (b >>> 18 | b << 14) ^ b >>> 3) + | ||
| ((a >>> 17 | a << 15) ^ (a >>> 19 | a << 13) ^ a >>> 10) + | ||
| W64[z - 7] + W64[z - 16]; | ||
| while (++z < 64); | ||
| let c = STATE[z = 0], d = STATE[1], e = STATE[2], f = STATE[3], g = STATE[4]; | ||
| let h = STATE[5], i = STATE[6], j = STATE[7]; | ||
| do | ||
| a = ((g >>> 6 | g << 26) ^ (g >>> 11 | g << 21) ^ (g >>> 25 | g << 7)) + | ||
| (g & h ^ ~g & i) + j + K64[z] + W64[z], | ||
| b = ((c >>> 2 | c << 30) ^ (c >>> 13 | c << 19) ^ (c >>> 22 | c << 10)) + | ||
| (d & e ^ c & d ^ c & e), | ||
| j = i, | ||
| i = h, | ||
| h = g, | ||
| g = f + a | 0, | ||
| f = e, | ||
| e = d, | ||
| d = c, | ||
| c = a + b | 0; | ||
| while (++z < 64); | ||
| STATE[0] = STATE[0] + c | 0, STATE[1] = STATE[1] + d | 0; | ||
| STATE[2] = STATE[2] + e | 0, STATE[3] = STATE[3] + f | 0; | ||
| STATE[4] = STATE[4] + g | 0, STATE[5] = STATE[5] + h | 0; | ||
| STATE[6] = STATE[6] + i | 0, STATE[7] = STATE[7] + j | 0; | ||
| }; | ||
| const U80 = /* @__PURE__ */ new Uint32Array(80); | ||
| const L80 = /* @__PURE__ */ new Uint32Array(80); | ||
| const K80 = /* @__PURE__ */ (0, lib_js_1.iv)("428a2f9871374491b5c0fbcfe9b5dba53956c25b59f111f1923f82a4ab1c5ed5d807aa9812835b01243185be550c7dc372be5d7480deb1fe9bdc06a7c19bf174e49b69c1efbe47860fc19dc6240ca1cc2de92c6f4a7484aa5cb0a9dc76f988da983e5152a831c66db00327c8bf597fc7c6e00bf3d5a7914706ca63511429296727b70a852e1b21384d2c6dfc53380d13650a7354766a0abb81c2c92e92722c85a2bfe8a1a81a664bc24b8b70c76c51a3d192e819d6990624f40e3585106aa07019a4c1161e376c082748774c34b0bcb5391c0cb34ed8aa4a5b9cca4f682e6ff3748f82ee78a5636f84c878148cc7020890befffaa4506cebbef9a3f7c67178f2ca273eced186b8c7eada7dd6f57d4f7f06f067aa0a637dc5113f98041b710b3528db77f532caab7b3c9ebe0a431d67c44cc5d4be597f299c5fcb6fab6c44198cd728ae2223ef65cdec4d3b2f8189dbbcf348b538b605d019af194f9bda6d8118a303024245706fbe4ee4b28cd5ffb4e2f27b896f3b1696b125c71235cf6926949ef14ad2384f25e38b8cd5b577ac9c65592b02756ea6e483bd41fbd4831153b5ee66dfab2db4321098fb213fbeef0ee43da88fc2930aa725e003826f0a0e6e7046d22ffc5c26c9265ac42aed9d95b3df8baf63de3c77b2a847edaee61482353b4cf10364bc423001d0f897910654be30d6ef52185565a9105771202a32bbd1b8b8d2d0c85141ab53df8eeb99e19b48a8c5c95a63e3418acb7763e373d6b2b8a35defb2fc43172f60a1f0ab721a6439ec23631e28de82bde9b2c67915e372532bea26619c21c0c207cde0eb1eee6ed17872176fbaa2c898a6bef90dae131c471b23047d8440c7249315c9bebc9c100d4ccb3e42b6fc657e2a3ad6faec4a475817"); | ||
| const mix80 = (block, at) => { | ||
| let a, b, c, d, z = 0; | ||
| do | ||
| L80[z] = block.getUint32(at), | ||
| U80[z] = block.getUint32(at + 4), | ||
| at += 8; | ||
| while (++z < 16); | ||
| do | ||
| a = L80[z - 15], | ||
| b = U80[z - 15], | ||
| c = ((b >>> 1 | a << 31) ^ (b >>> 8 | a << 24) ^ (b >>> 7 | a << 25)) >>> 0, | ||
| d = (a >>> 1 | b << 31) ^ (a >>> 8 | b << 24) ^ a >>> 7, | ||
| a = L80[z - 2], | ||
| b = U80[z - 2], | ||
| U80[z] = c += U80[z - 16] + U80[z - 7] + (((b >>> 19 | a << 13) ^ | ||
| (a >>> 29 | b << 3) ^ (b >>> 6 | a << 26)) >>> 0), | ||
| L80[z] = d + ((a >>> 19 | b << 13) ^ (b >>> 29 | a << 3) ^ a >>> 6) + | ||
| L80[z - 7] + L80[z - 16] + (c / 0x100000000 | 0); | ||
| while (++z < 80); | ||
| let e = STATE[z = 0], f = STATE[1], g = STATE[2], h = STATE[3], i = STATE[4]; | ||
| let j = STATE[5], k = STATE[6], l = STATE[7], m = STATE[8], n = STATE[9]; | ||
| let o = STATE[10], p = STATE[11], q = STATE[12], r = STATE[13], s = STATE[14]; | ||
| let t = STATE[15], u, v; | ||
| do | ||
| a = (n >>> 9 | m << 23) ^ (m >>> 14 | n << 18) ^ (m >>> 18 | n << 14), | ||
| b = (m >>> 9 | n << 23) ^ (n >>> 14 | m << 18) ^ (n >>> 18 | m << 14), | ||
| u = t + (b >>> 0) + ((n & p ^ ~n & r) >>> 0) + K80[z + 80] + U80[z], | ||
| v = a + s + (m & o ^ ~m & q) + K80[z] + L80[z] + (u / 0x100000000 | 0) | 0, | ||
| a = (f >>> 2 | e << 30) ^ (f >>> 7 | e << 25) ^ (e >>> 28 | f << 4), | ||
| b = (e >>> 2 | f << 30) ^ (e >>> 7 | f << 25) ^ (f >>> 28 | e << 4), | ||
| c = g & i ^ g & e ^ i & e, | ||
| d = f & h ^ f & j ^ h & j, | ||
| s = q, | ||
| q = o, | ||
| o = m, | ||
| t = r, | ||
| r = p, | ||
| p = n >>> 0, | ||
| n = (u >>> 0) + l, | ||
| m = v + k + (n / 0x100000000 | 0) | 0, | ||
| k = i, | ||
| i = g, | ||
| g = e, | ||
| l = j, | ||
| j = h, | ||
| h = f >>> 0, | ||
| f = (b >>> 0) + (d >>> 0) + (u >>> 0), | ||
| e = (f / 0x100000000 | 0) + a + c + v | 0; | ||
| while (++z < 80); | ||
| STATE[0] += e + ((STATE[1] += f >>> 0) / 0x100000000 | 0); | ||
| STATE[2] += g + ((STATE[3] += h) / 0x100000000 | 0); | ||
| STATE[4] += i + ((STATE[5] += j) / 0x100000000 | 0); | ||
| STATE[6] += k + ((STATE[7] += l) / 0x100000000 | 0); | ||
| STATE[8] += m + ((STATE[9] += n >>> 0) / 0x100000000 | 0); | ||
| STATE[10] += o + ((STATE[11] += p) / 0x100000000 | 0); | ||
| STATE[12] += q + ((STATE[13] += r) / 0x100000000 | 0); | ||
| STATE[14] += s + ((STATE[15] += t) / 0x100000000 | 0); | ||
| }; | ||
| /** Hashes with SHA-224. */ | ||
| exports.sha224 = md.bind(null, | ||
| /* @__PURE__ */ (0, lib_js_1.iv)("c1059ed8367cd5073070dd17f70e5939ffc00b316858151164f98fa7befa4fa4"), mix64, 28); | ||
| /** Hashes with SHA-256. */ | ||
| exports.sha256 = md.bind(null, | ||
| /* @__PURE__ */ (0, lib_js_1.iv)("6a09e667bb67ae853c6ef372a54ff53a510e527f9b05688c1f83d9ab5be0cd19"), mix64, 32); | ||
| /** Hashes with SHA-384. */ | ||
| exports.sha384 = md.bind(null, | ||
| /* @__PURE__ */ (0, lib_js_1.iv)("cbbb9d5dc1059ed8629a292a367cd5079159015a3070dd17152fecd8f70e593967332667ffc00b318eb44a8768581511db0c2e0d64f98fa747b5481dbefa4fa4"), mix80, 48); | ||
| /** Hashes with SHA-512. */ | ||
| exports.sha512 = md.bind(null, | ||
| /* @__PURE__ */ (0, lib_js_1.iv)("6a09e667f3bcc908bb67ae8584caa73b3c6ef372fe94f82ba54ff53a5f1d36f1510e527fade682d19b05688c2b3e6c1f1f83d9abfb41bd6b5be0cd19137e2179"), mix80, 64); |
| { | ||
| "type": "commonjs" | ||
| } |
@@ -29,2 +29,1 @@ /** | ||
| export declare const verify: (publicKey: Uint8Array, message: Uint8Array, signature: Uint8Array) => null | boolean; | ||
| //# sourceMappingURL=ed25519.d.ts.map |
+0
-1
@@ -36,2 +36,1 @@ /** Clears and sets bits. */ | ||
| export declare const equals: (one: bigint, two: bigint) => boolean; | ||
| //# sourceMappingURL=lib.d.ts.map |
@@ -36,2 +36,1 @@ /** | ||
| export declare const convertPublic: ($: Uint8Array) => Uint8Array<ArrayBuffer>; | ||
| //# sourceMappingURL=x25519.d.ts.map |
@@ -26,2 +26,1 @@ /** Hash function (with parameter names from tuple). */ | ||
| export {}; | ||
| //# sourceMappingURL=lib.d.ts.map |
@@ -39,2 +39,1 @@ /** | ||
| export declare const sha512: Hash<[$: Uint8Array]>; | ||
| //# sourceMappingURL=sha2.d.ts.map |
+8
-4
| { | ||
| "name": "@libn/ecc", | ||
| "version": "0.3.2", | ||
| "version": "0.3.3", | ||
| "homepage": "https://jsr.io/@libn/ecc", | ||
| "repository": { | ||
@@ -8,10 +9,13 @@ "type": "git", | ||
| }, | ||
| "license": "GPL-3.0-or-later", | ||
| "license": "0BSD", | ||
| "main": "./script/ecc/x25519.js", | ||
| "module": "./esm/ecc/x25519.js", | ||
| "exports": { | ||
| "./x25519": { | ||
| "import": "./esm/ecc/x25519.js" | ||
| "import": "./esm/ecc/x25519.js", | ||
| "require": "./script/ecc/x25519.js" | ||
| }, | ||
| "./ed25519": { | ||
| "import": "./esm/ecc/ed25519.js" | ||
| "import": "./esm/ecc/ed25519.js", | ||
| "require": "./script/ecc/ed25519.js" | ||
| } | ||
@@ -18,0 +22,0 @@ }, |
| {"version":3,"file":"ed25519.d.ts","sourceRoot":"","sources":["../../src/ecc/ed25519.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAqBH,uDAAuD;AACvD,eAAO,MAAM,QAAQ,GAAI,GAAG,UAAU,KAAG,UAAU,CAAC,WAAW,CACrC,CAAC;AAC3B,4CAA4C;AAC5C,eAAO,MAAM,IAAI,GACf,WAAW,UAAU,EACrB,SAAS,UAAU,KAClB,UAAU,CAAC,WAAW,CAMxB,CAAC;AACF,8CAA8C;AAC9C,eAAO,MAAM,MAAM,GACjB,WAAW,UAAU,EACrB,SAAS,UAAU,EACnB,WAAW,UAAU,KACpB,IAAI,GAAG,OAaT,CAAC"} |
| {"version":3,"file":"lib.d.ts","sourceRoot":"","sources":["../../src/ecc/lib.ts"],"names":[],"mappings":"AAEA,4BAA4B;AAC5B,eAAO,MAAM,KAAK,GAAI,GAAG,UAAU,KAAG,UAAU,CAAC,WAAW,CAI3D,CAAC;AACF,kCAAkC;AAClC,eAAO,MAAM,KAAK,GAAI,GAAG,UAAU,KAAG,MAIrC,CAAC;AACF,kCAAkC;AAClC,eAAO,MAAM,KAAK,GAAI,GAAG,MAAM,KAAG,UAAU,CAAC,WAAW,CAIvD,CAAC;AACF,wBAAwB;AACxB,eAAO,MAAM,CAAC,EAAE,MAAqD,CAAC;AACtE,wBAAwB;AACxB,eAAO,MAAM,CAAC,EAAE,MAC4C,CAAC;AAC7D,wBAAwB;AACxB,eAAO,MAAM,GAAG,GAAI,GAAG,MAAM,KAAG,MAAmC,CAAC;AACpE,kCAAkC;AAClC,eAAO,MAAM,GAAG,GAAI,MAAM,MAAM,EAAE,OAAO,MAAM,EAAE,mBAAiB,KAAG,MAGpE,CAAC;AACF,wBAAwB;AACxB,eAAO,MAAM,GAAG,GAAI,GAAG,MAAM,KAAG,MAI/B,CAAC;AACF,6BAA6B;AAC7B,eAAO,MAAM,GAAG,GAAI,MAAM,MAAM,EAAE,aAAiB,KAAG,MAIrD,CAAC;AASF,sBAAsB;AACtB,eAAO,MAAM,CAAC,EAAE,MAAkD,CAAC;AACnE,uBAAuB;AACvB,eAAO,MAAM,GAAG,GAAI,KAAK,MAAM,EAAE,KAAK,MAAM,KAAG,MAO9C,CAAC;AACF,uBAAuB;AACvB,eAAO,MAAM,MAAM,GAAI,GAAG,MAAM,KAAG,MAMlC,CAAC;AAWF,6CAA6C;AAC7C,eAAO,MAAM,IAAI,GAAI,GAAG,MAAM,KAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAStD,CAAC;AACF,uDAAuD;AACvD,eAAO,MAAM,OAAO,GAAI,GAAG,MAAM,KAAG,UAAU,CAAC,WAAW,CAIzD,CAAC;AACF,mDAAmD;AACnD,eAAO,MAAM,OAAO,GAAI,GAAG,UAAU,KAAG,MAcvC,CAAC;AACF,2BAA2B;AAC3B,eAAO,MAAM,MAAM,GAAI,KAAK,MAAM,EAAE,KAAK,MAAM,KAAG,OAIjD,CAAC"} |
| {"version":3,"file":"x25519.d.ts","sourceRoot":"","sources":["../../src/ecc/x25519.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAKH,sDAAsD;AACtD,eAAO,MAAM,MAAM,GAAI,QAAQ,MAAM,EAAE,OAAO,MAAM,KAAG,MAuBtD,CAAC;AACF,oCAAoC;AACpC,eAAO,MAAM,MAAM,GAAI,YAAY,UAAU,KAAG,UAAU,CAAC,WAAW,CAC5B,CAAC;AAC3C,2EAA2E;AAC3E,eAAO,MAAM,QAAQ,GACnB,YAAY,UAAU,EACtB,YAAY,UAAU,KACrB,UAAU,CAAC,WAAW,CAAC,GAAG,IAK5B,CAAC;AACF,+DAA+D;AAC/D,eAAO,MAAM,aAAa,GAAI,GAAG,UAAU,KAAG,UAAU,CAAC,WAAW,CAC1B,CAAC;AAC3C,+DAA+D;AAC/D,eAAO,MAAM,aAAa,GAAI,GAAG,UAAU,KAAG,UAAU,CAAC,WAAW,CAGnE,CAAC"} |
| {"version":3,"file":"lib.d.ts","sourceRoot":"","sources":["../../src/hash/lib.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,MAAM,MAAM,IAAI,CAAC,CAAC,SAAS,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,KAAK,UAAU,CAAC,WAAW,CAAC,CAAC;AAC9E,uEAAuE;AACvE,eAAO,MAAM,EAAE,GAAI,KAAK,MAAM,KAAG,WAAW,CAAC,WAAW,CACO,CAAC;AAChE,kEAAkE;AAClE,eAAO,MAAM,IAAI,GACf,KAAK,MAAM,GAAG,MAAM,EAAE,EACtB,QAAQ,MAAM,KACb,UAAU,CAAC,WAAW,CAC+B,CAAC;AACzD,gBAAgB;AAChB,UAAU,IAAI,CAAC,CAAC;IACd,EAAE,EAAE,CAAC,CAAC;IACN,EAAE,EAAE,CAAC,CAAC;CACP;AACD,uDAAuD;AACvD,MAAM,WAAW,OAAQ,SAAQ,IAAI,CAAC,MAAM,CAAC;CAAG;AAChD,uCAAuC;AACvC,eAAO,MAAM,SAAS,GAAI,GAAG,MAAM,KAAG,OAErC,CAAC;AACF,uCAAuC;AACvC,eAAO,MAAM,SAAS,GAAI,GAAG,OAAO,KAAG,MACS,CAAC;AACjD,0DAA0D;AAC1D,eAAO,MAAM,KAAK,GAAI,KAAK,MAAM,EAAE,KAAK,MAAM,KAAG,OAIhD,CAAC;AACF,+DAA+D;AAC/D,eAAO,MAAM,MAAM,GAAI,KAAK,OAAO,EAAE,KAAK,OAAO,KAAG,IAInD,CAAC;AACF,gFAAgF;AAChF,eAAO,MAAM,MAAM,GAAI,KAAK,OAAO,EAAE,KAAK,OAAO,KAAG,IAMnD,CAAC"} |
| {"version":3,"file":"sha2.d.ts","sourceRoot":"","sources":["../../src/hash/sha2.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAE,KAAK,IAAI,EAAM,MAAM,UAAU,CAAC;AA2GzC,2BAA2B;AAC3B,eAAO,MAAM,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,CAOxC,CAAC;AACF,2BAA2B;AAC3B,eAAO,MAAM,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,CAOxC,CAAC;AACF,2BAA2B;AAC3B,eAAO,MAAM,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,CAOxC,CAAC;AACF,2BAA2B;AAC3B,eAAO,MAAM,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,CAOxC,CAAC"} |
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
Copyleft License
LicenseCopyleft license information was found.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
Non-permissive License
LicenseA license not known to be considered permissive was found.
Found 1 instance in 1 package
56170
85.72%25
47.06%0
-100%100
42.86%1263
107.05%1
-50%1
-50%18
Infinity%2
100%