Debian Codegraph @

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

raw
1 // Copyright 2014 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-384 cryptographic hash.
17 *
18 * Usage:
19 * var sha384 = new goog.crypt.Sha384();
20 * sha384.update(bytes);
21 * var hash = sha384.digest();
22 *
23 * @author [email protected] (Frank Yellin)
24 */
25
26 goog.provide('goog.crypt.Sha384');
27
28 goog.require('goog.crypt.Sha2_64bit');
29
30
31
32 /**
33 * Constructs a SHA-384 cryptographic hash.
34 *
35 * @constructor
36 * @extends {goog.crypt.Sha2_64bit}
37 * @final
38 * @struct
39 */
40 goog.crypt.Sha384 = function() {
41 goog.crypt.Sha384.base(
42 this, 'constructor', 6 /* numHashBlocks */,
43 goog.crypt.Sha384.INIT_HASH_BLOCK_);
44 };
45 goog.inherits(goog.crypt.Sha384, goog.crypt.Sha2_64bit);
46
47
48 /** @private {!Array<number>} */
49 goog.crypt.Sha384.INIT_HASH_BLOCK_ = [
50 // Section 5.3.4 of
51 // csrc.nist.gov/publications/fips/fips180-4/fips-180-4.pdf
52 0xcbbb9d5d, 0xc1059ed8, // H0
53 0x629a292a, 0x367cd507, // H1
54 0x9159015a, 0x3070dd17, // H2
55 0x152fecd8, 0xf70e5939, // H3
56 0x67332667, 0xffc00b31, // H4
57 0x8eb44a87, 0x68581511, // H5
58 0xdb0c2e0d, 0x64f98fa7, // H6
59 0x47b5481d, 0xbefa4fa4 // H7
60 ];