Debian Codegraph @

closure-library/closure/goog/crypt/sha256.js

raw
1 // Copyright 2012 The Closure Library Authors. All Rights Reserved.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS-IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 /**
16 * @fileoverview SHA-256 cryptographic hash.
17 *
18 * Usage:
19 * var sha256 = new goog.crypt.Sha256();
20 * sha256.update(bytes);
21 * var hash = sha256.digest();
22 *
23 */
24
25 goog.provide('goog.crypt.Sha256');
26
27 goog.require('goog.crypt.Sha2');
28
29
30
31 /**
32 * SHA-256 cryptographic hash constructor.
33 *
34 * @constructor
35 * @extends {goog.crypt.Sha2}
36 * @final
37 * @struct
38 */
39 goog.crypt.Sha256 = function() {
40 goog.crypt.Sha256.base(
41 this, 'constructor', 8, goog.crypt.Sha256.INIT_HASH_BLOCK_);
42 };
43 goog.inherits(goog.crypt.Sha256, goog.crypt.Sha2);
44
45
46 /** @private {!Array<number>} */
47 goog.crypt.Sha256.INIT_HASH_BLOCK_ = [
48 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c,
49 0x1f83d9ab, 0x5be0cd19
50 ];