UNPKG

@langchain/core

Version:
1 lines 22.3 kB
{"version":3,"file":"hash.cjs","names":["blocks"],"sources":["../../../src/utils/js-sha256/hash.ts"],"sourcesContent":["// @ts-nocheck\n\n// Inlined to deal with portability issues with importing crypto module\n\n/**\n * [js-sha256]{@link https://github.com/emn178/js-sha256}\n *\n * @version 0.11.1\n * @author Chen, Yi-Cyuan [emn178@gmail.com]\n * @copyright Chen, Yi-Cyuan 2014-2025\n * @license MIT\n */\n/*jslint bitwise: true */\n\"use strict\";\n\nvar HEX_CHARS = \"0123456789abcdef\".split(\"\");\nvar EXTRA = [-2147483648, 8388608, 32768, 128];\nvar SHIFT = [24, 16, 8, 0];\nvar K = [\n 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1,\n 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,\n 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786,\n 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,\n 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147,\n 0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,\n 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b,\n 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,\n 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a,\n 0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,\n 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2,\n];\nvar OUTPUT_TYPES = [\"hex\", \"array\", \"digest\", \"arrayBuffer\"];\n\nvar blocks = [];\n\nfunction Sha256(is224, sharedMemory) {\n if (sharedMemory) {\n blocks[0] =\n blocks[16] =\n blocks[1] =\n blocks[2] =\n blocks[3] =\n blocks[4] =\n blocks[5] =\n blocks[6] =\n blocks[7] =\n blocks[8] =\n blocks[9] =\n blocks[10] =\n blocks[11] =\n blocks[12] =\n blocks[13] =\n blocks[14] =\n blocks[15] =\n 0;\n this.blocks = blocks;\n } else {\n this.blocks = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];\n }\n\n if (is224) {\n this.h0 = 0xc1059ed8;\n this.h1 = 0x367cd507;\n this.h2 = 0x3070dd17;\n this.h3 = 0xf70e5939;\n this.h4 = 0xffc00b31;\n this.h5 = 0x68581511;\n this.h6 = 0x64f98fa7;\n this.h7 = 0xbefa4fa4;\n } else {\n // 256\n this.h0 = 0x6a09e667;\n this.h1 = 0xbb67ae85;\n this.h2 = 0x3c6ef372;\n this.h3 = 0xa54ff53a;\n this.h4 = 0x510e527f;\n this.h5 = 0x9b05688c;\n this.h6 = 0x1f83d9ab;\n this.h7 = 0x5be0cd19;\n }\n\n this.block = this.start = this.bytes = this.hBytes = 0;\n this.finalized = this.hashed = false;\n this.first = true;\n this.is224 = is224;\n}\n\nSha256.prototype.update = function (message) {\n if (this.finalized) {\n return;\n }\n var notString,\n type = typeof message;\n if (type !== \"string\") {\n if (type === \"object\") {\n if (message === null) {\n throw new Error(ERROR);\n } else if (ARRAY_BUFFER && message.constructor === ArrayBuffer) {\n message = new Uint8Array(message);\n } else if (!Array.isArray(message)) {\n if (!ARRAY_BUFFER || !ArrayBuffer.isView(message)) {\n throw new Error(ERROR);\n }\n }\n } else {\n throw new Error(ERROR);\n }\n notString = true;\n }\n var code,\n index = 0,\n i,\n length = message.length,\n blocks = this.blocks;\n while (index < length) {\n if (this.hashed) {\n this.hashed = false;\n blocks[0] = this.block;\n this.block =\n blocks[16] =\n blocks[1] =\n blocks[2] =\n blocks[3] =\n blocks[4] =\n blocks[5] =\n blocks[6] =\n blocks[7] =\n blocks[8] =\n blocks[9] =\n blocks[10] =\n blocks[11] =\n blocks[12] =\n blocks[13] =\n blocks[14] =\n blocks[15] =\n 0;\n }\n\n if (notString) {\n for (i = this.start; index < length && i < 64; ++index) {\n blocks[i >>> 2] |= message[index] << SHIFT[i++ & 3];\n }\n } else {\n for (i = this.start; index < length && i < 64; ++index) {\n code = message.charCodeAt(index);\n if (code < 0x80) {\n blocks[i >>> 2] |= code << SHIFT[i++ & 3];\n } else if (code < 0x800) {\n blocks[i >>> 2] |= (0xc0 | (code >>> 6)) << SHIFT[i++ & 3];\n blocks[i >>> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3];\n } else if (code < 0xd800 || code >= 0xe000) {\n blocks[i >>> 2] |= (0xe0 | (code >>> 12)) << SHIFT[i++ & 3];\n blocks[i >>> 2] |= (0x80 | ((code >>> 6) & 0x3f)) << SHIFT[i++ & 3];\n blocks[i >>> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3];\n } else {\n code =\n 0x10000 +\n (((code & 0x3ff) << 10) | (message.charCodeAt(++index) & 0x3ff));\n blocks[i >>> 2] |= (0xf0 | (code >>> 18)) << SHIFT[i++ & 3];\n blocks[i >>> 2] |= (0x80 | ((code >>> 12) & 0x3f)) << SHIFT[i++ & 3];\n blocks[i >>> 2] |= (0x80 | ((code >>> 6) & 0x3f)) << SHIFT[i++ & 3];\n blocks[i >>> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3];\n }\n }\n }\n\n this.lastByteIndex = i;\n this.bytes += i - this.start;\n if (i >= 64) {\n this.block = blocks[16];\n this.start = i - 64;\n this.hash();\n this.hashed = true;\n } else {\n this.start = i;\n }\n }\n if (this.bytes > 4294967295) {\n this.hBytes += (this.bytes / 4294967296) << 0;\n this.bytes = this.bytes % 4294967296;\n }\n return this;\n};\n\nSha256.prototype.finalize = function () {\n if (this.finalized) {\n return;\n }\n this.finalized = true;\n var blocks = this.blocks,\n i = this.lastByteIndex;\n blocks[16] = this.block;\n blocks[i >>> 2] |= EXTRA[i & 3];\n this.block = blocks[16];\n if (i >= 56) {\n if (!this.hashed) {\n this.hash();\n }\n blocks[0] = this.block;\n blocks[16] =\n blocks[1] =\n blocks[2] =\n blocks[3] =\n blocks[4] =\n blocks[5] =\n blocks[6] =\n blocks[7] =\n blocks[8] =\n blocks[9] =\n blocks[10] =\n blocks[11] =\n blocks[12] =\n blocks[13] =\n blocks[14] =\n blocks[15] =\n 0;\n }\n blocks[14] = (this.hBytes << 3) | (this.bytes >>> 29);\n blocks[15] = this.bytes << 3;\n this.hash();\n};\n\nSha256.prototype.hash = function () {\n var a = this.h0,\n b = this.h1,\n c = this.h2,\n d = this.h3,\n e = this.h4,\n f = this.h5,\n g = this.h6,\n h = this.h7,\n blocks = this.blocks,\n j,\n s0,\n s1,\n maj,\n t1,\n t2,\n ch,\n ab,\n da,\n cd,\n bc;\n\n for (j = 16; j < 64; ++j) {\n // rightrotate\n t1 = blocks[j - 15];\n s0 = ((t1 >>> 7) | (t1 << 25)) ^ ((t1 >>> 18) | (t1 << 14)) ^ (t1 >>> 3);\n t1 = blocks[j - 2];\n s1 = ((t1 >>> 17) | (t1 << 15)) ^ ((t1 >>> 19) | (t1 << 13)) ^ (t1 >>> 10);\n blocks[j] = (blocks[j - 16] + s0 + blocks[j - 7] + s1) << 0;\n }\n\n bc = b & c;\n for (j = 0; j < 64; j += 4) {\n if (this.first) {\n if (this.is224) {\n ab = 300032;\n t1 = blocks[0] - 1413257819;\n h = (t1 - 150054599) << 0;\n d = (t1 + 24177077) << 0;\n } else {\n ab = 704751109;\n t1 = blocks[0] - 210244248;\n h = (t1 - 1521486534) << 0;\n d = (t1 + 143694565) << 0;\n }\n this.first = false;\n } else {\n s0 =\n ((a >>> 2) | (a << 30)) ^\n ((a >>> 13) | (a << 19)) ^\n ((a >>> 22) | (a << 10));\n s1 =\n ((e >>> 6) | (e << 26)) ^\n ((e >>> 11) | (e << 21)) ^\n ((e >>> 25) | (e << 7));\n ab = a & b;\n maj = ab ^ (a & c) ^ bc;\n ch = (e & f) ^ (~e & g);\n t1 = h + s1 + ch + K[j] + blocks[j];\n t2 = s0 + maj;\n h = (d + t1) << 0;\n d = (t1 + t2) << 0;\n }\n s0 =\n ((d >>> 2) | (d << 30)) ^\n ((d >>> 13) | (d << 19)) ^\n ((d >>> 22) | (d << 10));\n s1 =\n ((h >>> 6) | (h << 26)) ^\n ((h >>> 11) | (h << 21)) ^\n ((h >>> 25) | (h << 7));\n da = d & a;\n maj = da ^ (d & b) ^ ab;\n ch = (g & h) ^ (~g & e);\n t1 = f + s1 + ch + K[j + 1] + blocks[j + 1];\n t2 = s0 + maj;\n g = (c + t1) << 0;\n c = (t1 + t2) << 0;\n s0 =\n ((c >>> 2) | (c << 30)) ^\n ((c >>> 13) | (c << 19)) ^\n ((c >>> 22) | (c << 10));\n s1 =\n ((g >>> 6) | (g << 26)) ^\n ((g >>> 11) | (g << 21)) ^\n ((g >>> 25) | (g << 7));\n cd = c & d;\n maj = cd ^ (c & a) ^ da;\n ch = (f & g) ^ (~f & h);\n t1 = e + s1 + ch + K[j + 2] + blocks[j + 2];\n t2 = s0 + maj;\n f = (b + t1) << 0;\n b = (t1 + t2) << 0;\n s0 =\n ((b >>> 2) | (b << 30)) ^\n ((b >>> 13) | (b << 19)) ^\n ((b >>> 22) | (b << 10));\n s1 =\n ((f >>> 6) | (f << 26)) ^\n ((f >>> 11) | (f << 21)) ^\n ((f >>> 25) | (f << 7));\n bc = b & c;\n maj = bc ^ (b & d) ^ cd;\n ch = (f & g) ^ (~f & h);\n t1 = e + s1 + ch + K[j + 3] + blocks[j + 3];\n t2 = s0 + maj;\n e = (a + t1) << 0;\n a = (t1 + t2) << 0;\n this.chromeBugWorkAround = true;\n }\n\n this.h0 = (this.h0 + a) << 0;\n this.h1 = (this.h1 + b) << 0;\n this.h2 = (this.h2 + c) << 0;\n this.h3 = (this.h3 + d) << 0;\n this.h4 = (this.h4 + e) << 0;\n this.h5 = (this.h5 + f) << 0;\n this.h6 = (this.h6 + g) << 0;\n this.h7 = (this.h7 + h) << 0;\n};\n\nSha256.prototype.hex = function () {\n this.finalize();\n\n var h0 = this.h0,\n h1 = this.h1,\n h2 = this.h2,\n h3 = this.h3,\n h4 = this.h4,\n h5 = this.h5,\n h6 = this.h6,\n h7 = this.h7;\n\n var hex =\n HEX_CHARS[(h0 >>> 28) & 0x0f] +\n HEX_CHARS[(h0 >>> 24) & 0x0f] +\n HEX_CHARS[(h0 >>> 20) & 0x0f] +\n HEX_CHARS[(h0 >>> 16) & 0x0f] +\n HEX_CHARS[(h0 >>> 12) & 0x0f] +\n HEX_CHARS[(h0 >>> 8) & 0x0f] +\n HEX_CHARS[(h0 >>> 4) & 0x0f] +\n HEX_CHARS[h0 & 0x0f] +\n HEX_CHARS[(h1 >>> 28) & 0x0f] +\n HEX_CHARS[(h1 >>> 24) & 0x0f] +\n HEX_CHARS[(h1 >>> 20) & 0x0f] +\n HEX_CHARS[(h1 >>> 16) & 0x0f] +\n HEX_CHARS[(h1 >>> 12) & 0x0f] +\n HEX_CHARS[(h1 >>> 8) & 0x0f] +\n HEX_CHARS[(h1 >>> 4) & 0x0f] +\n HEX_CHARS[h1 & 0x0f] +\n HEX_CHARS[(h2 >>> 28) & 0x0f] +\n HEX_CHARS[(h2 >>> 24) & 0x0f] +\n HEX_CHARS[(h2 >>> 20) & 0x0f] +\n HEX_CHARS[(h2 >>> 16) & 0x0f] +\n HEX_CHARS[(h2 >>> 12) & 0x0f] +\n HEX_CHARS[(h2 >>> 8) & 0x0f] +\n HEX_CHARS[(h2 >>> 4) & 0x0f] +\n HEX_CHARS[h2 & 0x0f] +\n HEX_CHARS[(h3 >>> 28) & 0x0f] +\n HEX_CHARS[(h3 >>> 24) & 0x0f] +\n HEX_CHARS[(h3 >>> 20) & 0x0f] +\n HEX_CHARS[(h3 >>> 16) & 0x0f] +\n HEX_CHARS[(h3 >>> 12) & 0x0f] +\n HEX_CHARS[(h3 >>> 8) & 0x0f] +\n HEX_CHARS[(h3 >>> 4) & 0x0f] +\n HEX_CHARS[h3 & 0x0f] +\n HEX_CHARS[(h4 >>> 28) & 0x0f] +\n HEX_CHARS[(h4 >>> 24) & 0x0f] +\n HEX_CHARS[(h4 >>> 20) & 0x0f] +\n HEX_CHARS[(h4 >>> 16) & 0x0f] +\n HEX_CHARS[(h4 >>> 12) & 0x0f] +\n HEX_CHARS[(h4 >>> 8) & 0x0f] +\n HEX_CHARS[(h4 >>> 4) & 0x0f] +\n HEX_CHARS[h4 & 0x0f] +\n HEX_CHARS[(h5 >>> 28) & 0x0f] +\n HEX_CHARS[(h5 >>> 24) & 0x0f] +\n HEX_CHARS[(h5 >>> 20) & 0x0f] +\n HEX_CHARS[(h5 >>> 16) & 0x0f] +\n HEX_CHARS[(h5 >>> 12) & 0x0f] +\n HEX_CHARS[(h5 >>> 8) & 0x0f] +\n HEX_CHARS[(h5 >>> 4) & 0x0f] +\n HEX_CHARS[h5 & 0x0f] +\n HEX_CHARS[(h6 >>> 28) & 0x0f] +\n HEX_CHARS[(h6 >>> 24) & 0x0f] +\n HEX_CHARS[(h6 >>> 20) & 0x0f] +\n HEX_CHARS[(h6 >>> 16) & 0x0f] +\n HEX_CHARS[(h6 >>> 12) & 0x0f] +\n HEX_CHARS[(h6 >>> 8) & 0x0f] +\n HEX_CHARS[(h6 >>> 4) & 0x0f] +\n HEX_CHARS[h6 & 0x0f];\n if (!this.is224) {\n hex +=\n HEX_CHARS[(h7 >>> 28) & 0x0f] +\n HEX_CHARS[(h7 >>> 24) & 0x0f] +\n HEX_CHARS[(h7 >>> 20) & 0x0f] +\n HEX_CHARS[(h7 >>> 16) & 0x0f] +\n HEX_CHARS[(h7 >>> 12) & 0x0f] +\n HEX_CHARS[(h7 >>> 8) & 0x0f] +\n HEX_CHARS[(h7 >>> 4) & 0x0f] +\n HEX_CHARS[h7 & 0x0f];\n }\n return hex;\n};\n\nSha256.prototype.toString = Sha256.prototype.hex;\n\nSha256.prototype.digest = function () {\n this.finalize();\n\n var h0 = this.h0,\n h1 = this.h1,\n h2 = this.h2,\n h3 = this.h3,\n h4 = this.h4,\n h5 = this.h5,\n h6 = this.h6,\n h7 = this.h7;\n\n var arr = [\n (h0 >>> 24) & 0xff,\n (h0 >>> 16) & 0xff,\n (h0 >>> 8) & 0xff,\n h0 & 0xff,\n (h1 >>> 24) & 0xff,\n (h1 >>> 16) & 0xff,\n (h1 >>> 8) & 0xff,\n h1 & 0xff,\n (h2 >>> 24) & 0xff,\n (h2 >>> 16) & 0xff,\n (h2 >>> 8) & 0xff,\n h2 & 0xff,\n (h3 >>> 24) & 0xff,\n (h3 >>> 16) & 0xff,\n (h3 >>> 8) & 0xff,\n h3 & 0xff,\n (h4 >>> 24) & 0xff,\n (h4 >>> 16) & 0xff,\n (h4 >>> 8) & 0xff,\n h4 & 0xff,\n (h5 >>> 24) & 0xff,\n (h5 >>> 16) & 0xff,\n (h5 >>> 8) & 0xff,\n h5 & 0xff,\n (h6 >>> 24) & 0xff,\n (h6 >>> 16) & 0xff,\n (h6 >>> 8) & 0xff,\n h6 & 0xff,\n ];\n if (!this.is224) {\n arr.push(\n (h7 >>> 24) & 0xff,\n (h7 >>> 16) & 0xff,\n (h7 >>> 8) & 0xff,\n h7 & 0xff\n );\n }\n return arr;\n};\n\nSha256.prototype.array = Sha256.prototype.digest;\n\nSha256.prototype.arrayBuffer = function () {\n this.finalize();\n\n var buffer = new ArrayBuffer(this.is224 ? 28 : 32);\n var dataView = new DataView(buffer);\n dataView.setUint32(0, this.h0);\n dataView.setUint32(4, this.h1);\n dataView.setUint32(8, this.h2);\n dataView.setUint32(12, this.h3);\n dataView.setUint32(16, this.h4);\n dataView.setUint32(20, this.h5);\n dataView.setUint32(24, this.h6);\n if (!this.is224) {\n dataView.setUint32(28, this.h7);\n }\n return buffer;\n};\n\nexport const sha256 = (...strings: string[]) => {\n return new Sha256(false, true).update(strings.join(\"\")).hex();\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