PageSourceSearch

https://plink.gg/scripts/sha256.js

js plink.gg collected 2026-10-08 12:06:08 UTC 18,387 bytes, 518 lines download raw bytes

1/**
2 * [js-sha256]{@link https://github.com/emn178/js-sha256}
3 *
4 * @version 0.9.0
5 * @author Chen, Yi-Cyuan [[email protected]]
6 * @copyright Chen, Yi-Cyuan 2014-2017
7 * @license MIT
8 */
9/*jslint bitwise: true */
10(function () {
11  'use strict';
12
13  var ERROR = 'input is invalid type';
14  var WINDOW = typeof window === 'object';
15  var root = WINDOW ? window : {};
16  if (root.JS_SHA256_NO_WINDOW) {
17    WINDOW = false;
18  }
19  var WEB_WORKER = !WINDOW && typeof self === 'object';
20  var NODE_JS = !root.JS_SHA256_NO_NODE_JS && typeof process === 'object' && process.versions && process.versions.node;
21  if (NODE_JS) {
22    root = global;
23  } else if (WEB_WORKER) {
24    root = self;
25  }
26  var COMMON_JS = !root.JS_SHA256_NO_COMMON_JS && typeof module === 'object' && module.exports;
27  var AMD = typeof define === 'function' && define.amd;
28  var ARRAY_BUFFER = !root.JS_SHA256_NO_ARRAY_BUFFER && typeof ArrayBuffer !== 'undefined';
29  var HEX_CHARS = '0123456789abcdef'.split('');
30  var EXTRA = [-2147483648, 8388608, 32768, 128];
31  var SHIFT = [24, 16, 8, 0];
32  var K = [
33    0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
34    0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
35    0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
36    0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
37    0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
38    0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
39    0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
40    0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
41  ];
42  var OUTPUT_TYPES = ['hex', 'array', 'digest', 'arrayBuffer'];
43
44  var blocks = [];
45
46  if (root.JS_SHA256_NO_NODE_JS || !Array.isArray) {
47    Array.isArray = function (obj) {
48      return Object.prototype.toString.call(obj) === '[object Array]';
49    };
50  }
51
52  if (ARRAY_BUFFER && (root.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW || !ArrayBuffer.isView)) {
53    ArrayBuffer.isView = function (obj) {
54      return typeof obj === 'object' && obj.buffer && obj.buffer.constructor === ArrayBuffer;
55    };
56  }
57
58  var createOutputMethod = function (outputType, is224) {
59    return function (message) {
60      return new Sha256(is224, true).update(message)[outputType]();
61    };
62  };
63
64  var createMethod = function (is224) {
65    var method = createOutputMethod('hex', is224);
66    if (NODE_JS) {
67      method = nodeWrap(method, is224);
68    }
69    method.create = function () {
70      return new Sha256(is224);
71    };
72    method.update = function (message) {
73      return method.create().update(message);
74    };
75    for (var i = 0; i < OUTPUT_TYPES.length; ++i) {
76      var type = OUTPUT_TYPES[i];
77      method[type] = createOutputMethod(type, is224);
78    }
79    return method;
80  };
81
82  var nodeWrap = function (method, is224) {
83    var crypto = eval("require('crypto')");
84    var Buffer = eval("require('buffer').Buffer");
85    var algorithm = is224 ? 'sha224' : 'sha256';
86    var nodeMethod = function (message) {
87      if (typeof message === 'string') {
88        return crypto.createHash(algorithm).update(message, 'utf8').digest('hex');
89      } else {
90        if (message === null || message === undefined) {
91          throw new Error(ERROR);
92        } else if (message.constructor === ArrayBuffer) {
93          message = new Uint8Array(message);
94        }
95      }
96      if (Array.isArray(message) || ArrayBuffer.isView(message) ||
97        message.constructor === Buffer) {
98        return crypto.createHash(algorithm).update(new Buffer(message)).digest('hex');
99      } else {
100        return method(message);
101      }
102    };
103    return nodeMethod;
104  };
105
106  var createHmacOutputMethod = function (outputType, is224) {
107    return function (key, message) {
108      return new HmacSha256(key, is224, true).update(message)[outputType]();
109    };
110  };
111
112  var createHmacMethod = function (is224) {
113    var method = createHmacOutputMethod('hex', is224);
114    method.create = function (key) {
115      return new HmacSha256(key, is224);
116    };
117    method.update = function (key, message) {
118      return method.create(key).update(message);
119    };
120    for (var i = 0; i < OUTPUT_TYPES.length; ++i) {
121      var type = OUTPUT_TYPES[i];
122      method[type] = createHmacOutputMethod(type, is224);
123    }
124    return method;
125  };
126
127  function Sha256(is224, sharedMemory) {
128    if (sharedMemory) {
129      blocks[0] = blocks[16] = blocks[1] = blocks[2] = blocks[3] 
129=
130        blocks[4] = blocks[5] = blocks[6] = blocks[7] =
131        blocks[8] = blocks[9] = blocks[10] = blocks[11] =
132        blocks[12] = blocks[13] = blocks[14] = blocks[15] = 0;
133      this.blocks = blocks;
134    } else {
135      this.blocks = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
136    }
137
138    if (is224) {
139      this.h0 = 0xc1059ed8;
140      this.h1 = 0x367cd507;
141      this.h2 = 0x3070dd17;
142      this.h3 = 0xf70e5939;
143      this.h4 = 0xffc00b31;
144      this.h5 = 0x68581511;
145      this.h6 = 0x64f98fa7;
146      this.h7 = 0xbefa4fa4;
147    } else { // 256
148      this.h0 = 0x6a09e667;
149      this.h1 = 0xbb67ae85;
150      this.h2 = 0x3c6ef372;
151      this.h3 = 0xa54ff53a;
152      this.h4 = 0x510e527f;
153      this.h5 = 0x9b05688c;
154      this.h6 = 0x1f83d9ab;
155      this.h7 = 0x5be0cd19;
156    }
157
158    this.block = this.start = this.bytes = this.hBytes = 0;
159    this.finalized = this.hashed = false;
160    this.first = true;
161    this.is224 = is224;
162  }
163
164  Sha256.prototype.update = function (message) {
165    if (this.finalized) {
166      return;
167    }
168    var notString, type = typeof message;
169    if (type !== 'string') {
170      if (type === 'object') {
171        if (message === null) {
172          throw new Error(ERROR);
173        } else if (ARRAY_BUFFER && message.constructor === ArrayBuffer) {
174          message = new Uint8Array(message);
175        } else if (!Array.isArray(message)) {
176          if (!ARRAY_BUFFER || !ArrayBuffer.isView(message)) {
177            throw new Error(ERROR);
178          }
179        }
180      } else {
181        throw new Error(ERROR);
182      }
183      notString = true;
184    }
185    var code, index = 0, i, length = message.length, blocks = this.blocks;
186
187    while (index < length) {
188      if (this.hashed) {
189        this.hashed = false;
190        blocks[0] = this.block;
191        blocks[16] = blocks[1] = blocks[2] = blocks[3] =
192          blocks[4] = blocks[5] = blocks[6] = blocks[7] =
193          blocks[8] = blocks[9] = blocks[10] = blocks[11] =
194          blocks[12] = blocks[13] = blocks[14] = blocks[15] = 0;
195      }
196
197      if (notString) {
198        for (i = this.start; index < length && i < 64; ++index) {
199          blocks[i >> 2] |= message[index] << SHIFT[i++ & 3];
200        }
201      } else {
202        for (i = this.start; index < length && i < 64; ++index) {
203          code = message.charCodeAt(index);
204          if (code < 0x80) {
205            blocks[i >> 2] |= code << SHIFT[i++ & 3];
206          } else if (code < 0x800) {
207            blocks[i >> 2] |= (0xc0 | (code >> 6)) << SHIFT[i++ & 3];
208            blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3];
209          } else if (code < 0xd800 || code >= 0xe000) {
210            blocks[i >> 2] |= (0xe0 | (code >> 12)) << SHIFT[i++ & 3];
211            blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3];
212            blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3];
213          } else {
214            code = 0x10000 + (((code & 0x3ff) << 10) | (message.charCodeAt(++index) & 0x3ff));
215            blocks[i >> 2] |= (0xf0 | (code >> 18)) << SHIFT[i++ & 3];
216            blocks[i >> 2] |= (0x80 | ((code >> 12) & 0x3f)) << SHIFT[i++ & 3];
217            blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3];
218            blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3];
219          }
220        }
221      }
222
223      this.lastByteIndex = i;
224      this.bytes += i - this.start;
225      if (i >= 64) {
226        this.block = blocks[16];
227        this.start = i - 64;
228        this.hash();
229        this.hashed = true;
230      } else {
231        this.start = i;
232      }
233    }
234    if (this.bytes > 4294967295) {
235      this.hBytes += this.bytes / 4294967296 << 0;
236      this.bytes = this.bytes % 4294967296;
237    }
238    return this;
239  };
240
241  Sha256.prototype.finalize = function () {
242    if (this.finalized) {
243      return;
244    }
245    this.finalized = true;
246    var blocks = this.blocks, i = this.lastByteIndex;
247    blocks[16] = this.block;
248    blocks[i >> 2] |= EXTRA[i & 3];
249    this.block = blocks[16];
250    if (i >= 56) {
251      if (!this.hashed) {
252        this.hash();
253      }
254      blocks[0] = this.block;
255      blocks[16] = blocks[1] = blocks[2] = blocks[3] =
256        blocks[4] = blocks[5] = blocks[6] = blocks[7] =
257        blocks[8] = blocks[9] = blocks[10] = blocks[11] =
258        blocks[12] = blocks[13] = blocks[14] = blocks[15] = 0;
259    }
260    blocks[14] = this.hBytes << 3 | this.bytes >>> 29;
261    blocks[15] = this.bytes << 3;
262    this.hash();
263  };
264
265  Sha256.prototype.hash = function () {
266    var a = this.h0, b = this.h1, c = this.h2, d = this.h3, e = this.h4, f = this.h5, g = this.h6,
267      h = this.h7, blocks = this.blocks, j, s0, s1, maj, t1, t2, ch, ab, da, cd, bc;
268
269    for (j = 16; j < 64; ++j) {
270      // rightrotate
271      t1 = blocks[j - 15];
272      s0 = ((t1 >>> 7) | (t1 << 25)) ^ ((t1 >>> 18) | (t1 << 14)) ^ (t1 >>> 3);
273      t1 = blocks[j - 2];
274      s1 = ((t1 >>> 17) | (t1 << 15)) ^ ((t1 >>> 19) | (t1 << 13)) ^ (t1 >>> 10);
275      blocks[j] = blocks[j - 16] + s0 + blocks[j - 7] + s1 << 0;
276    }
277
278    bc = b & c;
279    for (j = 0; j < 64; j += 4) {
280      if (this.first) {
281        if (this.is224) {
282          ab = 300032;
283          t1 = blocks[0] - 1413257819;
284          h = t1 - 150054599 << 0;
285          d = t1 + 24177077 << 0;
286        } else {
287          ab = 704751109;
288          t1 = blocks[0] - 210244248;
289          h = t1 - 1521486534 << 0;
290          d = t1 + 143694565 << 0;
291        }
292        this.first = false;
293      } else {
294        s0 = ((a >>> 2) | (a << 30)) ^ ((a >>> 13) | (a << 19)) ^ ((a >>> 22) | (a << 10));
295        s1 = ((e >>> 6) | (e << 26)) ^ ((e >>> 11) | (e << 21)) ^ ((e >>> 25) | (e << 7));
296        ab = a & b;
297        maj = ab ^ (a & c) ^ bc;
298        ch = (e & f) ^ (~e & g);
299        t1 = h + s1 + ch + K[j] + blocks[j];
300        t2 = s0 + maj;
301        h = d + t1 << 0;
302        d = t1 + t2 << 0;
303      }
304      s0 = ((d >>> 2) | (d << 30)) ^ ((d >>> 13) | (d << 19)) ^ ((d >>> 22) | (d << 10));
305      s1 = ((h >>> 6) | (h << 26)) ^ ((h >>> 11) | (h << 21)) ^ ((h >>> 25) | (h << 7));
306      da = d & a;
307      maj = da ^ (d & b) ^ ab;
308      ch = (h & e) ^ (~h & f);
309      t1 = g + s1 + ch + K[j + 1] + blocks[j + 1];
310      t2 = s0 + maj;
311      g = c + t1 << 0;
312      c = t1 + t2 << 0;
313      s0 = ((c >>> 2) | (c << 30)) ^ ((c >>> 13) | (c << 19)) ^ ((c >>> 22) | (c << 10));
314      s1 = ((g >>> 6) | (g << 26)) ^ ((g >>> 11) | (g << 21)) ^ ((g >>> 25) | (g << 7));
315      cd = c & d;
316      maj = cd ^ (c & a) ^ da;
317      ch = (g & h) ^ (~g & e);
318      t1 = f + s1 + ch + K[j + 2] + blocks[j + 2];
319      t2 = s0 + maj;
320      f = b + t1 << 0;
321      b = t1 + t2 << 0;
322      s0 = ((b >>> 2) | (b << 30)) ^ ((b >>> 13) | (b << 19)) ^ ((b >>> 22) | (b << 10));
323      s1 = ((f >>> 6) | (f << 26)) ^ ((f >>> 11) | (f << 21)) ^ ((f >>> 25) | (f << 7));
324      bc = b & c;
325      maj = bc ^ (b & d) ^ cd;
326      ch = (f & g) ^ (~f & h);
327      t1 = e + s1 + ch + K[j + 3] + blocks[j + 3];
328      t2 = s0 + maj;
329      e = a + t1 << 0;
330      a = t1 + t2 << 0;
331    }
332
333    this.h0 = this.h0 + a << 0;
334    this.h1 = this.h1 + b << 0;
335    this.h2 = this.h2 + c << 0;
336    this.h3 = this.h3 + d << 0;
337    this.h4 = this.h4 + e << 0;
338    this.h5 = this.h5 + f << 0;
339    this.h6 = this.h6 + g << 0;
340    this.h7 = this.h7 + h << 0;
341  };
342
343  Sha256.prototype.hex = function () {
344    this.finalize();
345
346    var h0 = this.h0, h1 = this.h1, h2 = this.h2, h3 = this.h3, h4 = this.h4, h5 = this.h5,
347      h6 = this.h6, h7 = this.h7;
348
349    var hex = HEX_CHARS[(h0 >> 28) & 0x0F] + HEX_CHARS[(h0 >> 24) & 0x0F] +
350      HEX_CHARS[(h0 >> 20) & 0x0F] + HEX_CHARS[(h0 >> 16) & 0x0F] +
351      HEX_CHARS[(h0 >> 12) & 0x0F] + HEX_CHARS[(h0 >> 8) & 0x0F] +
352      HEX_CHARS[(h0 >> 4) & 0x0F] + HEX_CHARS[h0 & 0x0F] +
353      HEX_CHARS[(h1 >> 28) & 0x0F] + HEX_CHARS[(h1 >> 24) & 0x0F] +
354      HEX_CHARS[(h1 >> 20) & 0x0F] + HEX_CHARS[(h1 >> 16) & 0x0F] +
355      HEX_CHARS[(h1 >> 12) & 0x0F] + HEX_CHARS[(h1 >> 8) & 0x0F] +
356      HEX_CHARS[(h1 >> 4) & 0x0F] + HEX_CHARS[h1 & 0x0F] +
357      HEX_CHARS[(h2 >> 28) & 0x0F] + HEX_CHARS[(h2 >> 24) & 0x0F] +
358      HEX_CHARS[(h2 >> 20) & 0x0F] + HEX_CHARS[(h2 >> 16) & 0x0F] +
359      HEX_CHARS[(h2 >> 12) & 0x0F] + HEX_CHARS[(h2 >> 8) & 0x0F] +
360      HEX_CHARS[(h2 >> 4) & 0x0F] + HEX_CHARS[h2 & 0x0F] +
361      HEX_CHARS[(h3 >> 28) & 0x0F] + HEX_CHARS[(h3 >> 24) & 0x0F] +
362      HEX_CHARS[(h3 >> 20) & 0x0F] + HEX_CHARS[(h3 >> 16) & 0x0F] +
363      HEX_CHARS[(h3 >> 12) & 0x0F] + HEX_CHARS[(h3 >> 8) & 0x0F] +
364      HEX_CHARS[(h3 >> 4) & 0x0F] + HEX_CHARS[h3 & 0x0F] +
365      HEX_CHARS[(h4 >> 28) & 0x0F] + HEX_CHARS[(h4 >> 24) & 0x0F] +
366      HEX_CHARS[(h4 >> 20) & 0x0F] + HEX_CHARS[(h4 >> 16) & 0x0F] +
367      HEX_CHARS[(h4 >> 12) & 0x0F] + HEX_CHARS[(h4 >> 8) & 0x0F] +
368      HEX_CHARS[(h4 >> 4) & 0x0F] + HEX_CHARS[h4 & 0x0F] +
369      HEX_CHARS[(h5 >> 28) & 0x0F] + HEX_CHARS[(h5 >> 24) & 0x0F] +
370      HEX_CHARS[(h5 >> 20) & 0x0F] + HEX_CHARS[(h5 >> 16) & 0x0F] +
371      HEX_CHARS[(h5 >> 12) & 0x0F] + HEX_CHARS[(h5 >> 8) & 0x0F] +
372      HEX_CHARS[(h5 >> 4) & 0x0F] + HEX_CHARS[h5 & 0x0F] +
373      HEX_CHARS[(h6 >> 28) & 0x0F] + HEX_CHARS[(h6 >> 24) & 0x0F] +
374      HEX_CHARS[(h6 >> 20) & 0x0F] + HEX_CHARS[(h6 >> 16) & 0x0F] +
375      HEX_CHARS[(h6 >> 12) & 0x0F] + HEX_CHARS[(h6 >> 8) & 0x0F] +
376      HEX_CHARS[(h6 >> 4) & 0x0F] + HEX_CHARS[h6 & 0x0F];
377    if (!this.is224) {
378      hex += HEX_CHARS[(h7 >> 28) & 0x0F] + HEX_CHARS[(h7 >> 24) & 0x0F] +
379        HEX_CHARS[(h7 >> 20) & 0x0F] + HEX_CHARS[(h7 >> 16) & 0x0F] +
380        HEX_CHARS[(h7 >> 12) & 0x0F] + HEX_CHARS[(h7 >> 8) & 0x0F] +
381        HEX_CHARS[(h7 >> 4) & 0x0F] + HEX_CHARS[h7 & 0x0F];
382    }
383    return hex;
384  };
385
386  Sha256.prototype.toString = Sha256.prototype.hex;
387
388  Sha256.prototype.digest = function () {
389    this.finalize();
390
391    var h0 = this.h0, h1 = this.h1, h2 = this.h2, h3 = this.h3, h4 = this.h4, h5 = this.h5,
392      h6 = this.h6, h7 = this.h7;
393
394    var arr = [
395      (h0 >> 24) & 0xFF, (h0 >> 16) & 0xFF, (h0 >> 8) & 0xFF, h0 & 0xFF,
396      (h1 >> 24) & 0xFF, (h1 >> 16) & 0xFF, (h1 >> 8) & 0xFF, h1 & 0xFF,
397      (h2 >> 24) & 0xFF, (h2 >> 16) & 0xFF, (h2 >> 8) & 0xFF, h2 & 0xFF,
398      (h3 >> 24) & 0xFF, (h3 >> 16) & 0xFF, (h3 >> 8) & 0xFF, h3 & 0xFF,
399      (h4 >> 24) & 0xFF, (h4 >> 16) & 0xFF, (h4 >> 8) & 0xFF, h4 & 0xFF,
400      (h5 >> 24) & 0xFF, (h5 >> 16) & 0xFF, (h5 >> 8) & 0xFF, h5 & 0xFF,
401      (h6 >> 24) & 0xFF, (h6 >> 16) & 0xFF, (h6 >> 8) & 0xFF, h6 & 0xFF
402    ];
403    if (!this.is224) {
404      arr.push((h7 >> 24) & 0xFF, (h7 >> 16) & 0xFF, (h7 >> 8) & 0xFF, h7 & 0xFF);
405    }
406    return arr;
407  };
408
409  Sha256.prototype.array = Sha256.prototype.digest;
410
411  Sha256.prototype.arrayBuffer = function () {
412    this.finalize();
413
414    var buffer = new ArrayBuffer(this.is224 ? 28 : 32);
415    var dataView = new DataView(buffer);
416    dataView.setUint32(0, this.h0);
417    dataView.setUint32(4, this.h1);
418    dataView.setUint32(8, this.h2);
419    dataView.setUint32(12, this.h3);
420    dataView.setUint32(16, this.h4);
421    dataView.setUint32(20, this.h5);
422    dataView.setUint32(24, this.h6);
423    if (!this.is224) {
424      dataView.setUint32(28, this.h7);
425    }
426    return buffer;
427  };
428
429  function HmacSha256(key, is224, sharedMemory) {
430    var i, type = typeof key;
431    if (type === 'string') {
432      var bytes = [], length = key.length, index = 0, code;
433      for (i = 0; i < length; ++i) {
434        code = key.charCodeAt(i);
435        if (code < 0x80) {
436          bytes[index++] = code;
437        } else if (code < 0x800) {
438          bytes[index++] = (0xc0 | (code >> 6));
439          bytes[index++] = (0x80 | (code & 0x3f));
440        } else if (code < 0xd800 || code >= 0xe000) {
441          bytes[index++] = (0xe0 | (code >> 12));
442          bytes[index++] = (0x80 | ((code >> 6) & 0x3f));
443          bytes[index++] = (0x80 | (code & 0x3f));
444        } else {
445          code = 0x10000 + (((code & 0x3ff) << 10) | (key.charCodeAt(++i) & 0x3ff));
446          bytes[index++] = (0xf0 | (code >> 18));
447          bytes[index++] = (0x80 | ((code >> 12) & 0x3f));
448          bytes[index++] = (0x80 | ((code >> 6) & 0x3f));
449          bytes[index++] = (0x80 | (code & 0x3f));
450        }
451      }
452      key = bytes;
453    } else {
454      if (type === 'object') {
455        if (key === null) {
456          throw new Error(ERROR);
457        } else if (ARRAY_BUFFER && key.constructor === ArrayBuffer) {
458          key = new Uint8Array(key);
459        } else if (!Array.isArray(key)) {
460          if (!ARRAY_BUFFER || !ArrayBuffer.isView(key)) {
461            throw new Error(ERROR);
462          }
463        }
464      } else {
465        throw new Error(ERROR);
466      }
467    }
468
469    if (key.length > 64) {
470      key = (new Sha256(is224, true)).update(key).array();
471    }
472
473    var oKeyPad = [], iKeyPad = [];
474    for (i = 0; i < 64; ++i) {
475      var b = key[i] || 0;
476      oKeyPad[i] = 0x5c ^ b;
477      iKeyPad[i] = 0x36 ^ b;
478    }
479
480    Sha256.call(this, is224, sharedMemory);
481
482    this.update(iKeyPad);
483    this.oKeyPad = oKeyPad;
484    this.inner = true;
485    this.sharedMemory = sharedMemory;
486  }
487  HmacSha256.prototype = new Sha256();
488
489  HmacSha256.prototype.finalize = function () {
490    Sha256.prototype.finalize.call(this);
491    if (this.inner) {
492      this.inner = false;
493      var innerHash = this.array();
494      Sha256.call(this, this.is224, this.sharedMemory);
495      this.update(this.oKeyPad);
496      this.update(innerHash);
497      Sha256.prototype.finalize.call(this);
498    }
499  };
500
501  var exports = createMethod();
502  exports.sha256 = exports;
503  exports.sha224 = createMethod(true);
504  exports.sha256.hmac = createHmacMethod();
505  exports.sha224.hmac = createHmacMethod(true);
506
507  if (COMMON_JS) {
508    module.exports = exports;
509  } else {
510    root.sha256 = exports.sha256;
511    root.sha224 = exports.sha224;
512    if (AMD) {
513      define(function () {
514        return exports;
515      });
516    }
517  }
518})();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.