Path: blob/trunk/third_party/closure/goog/crypt/sha512.js
2868 views
// Copyright 2014 The Closure Library Authors. All Rights Reserved.1//2// Licensed under the Apache License, Version 2.0 (the "License");3// you may not use this file except in compliance with the License.4// You may obtain a copy of the License at5//6// http://www.apache.org/licenses/LICENSE-2.07//8// Unless required by applicable law or agreed to in writing, software9// distributed under the License is distributed on an "AS-IS" BASIS,10// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.11// See the License for the specific language governing permissions and12// limitations under the License.1314/**15* @fileoverview SHA-512 cryptographic hash.16*17* Usage:18* var sha512 = new goog.crypt.Sha512();19* sha512.update(bytes);20* var hash = sha512.digest();21*22* @author [email protected] (Frank Yellin)23*/2425goog.provide('goog.crypt.Sha512');2627goog.require('goog.crypt.Sha2_64bit');28293031/**32* Constructs a SHA-512 cryptographic hash.33*34* @constructor35* @extends {goog.crypt.Sha2_64bit}36* @final37* @struct38*/39goog.crypt.Sha512 = function() {40goog.crypt.Sha512.base(41this, 'constructor', 8 /* numHashBlocks */,42goog.crypt.Sha512.INIT_HASH_BLOCK_);43};44goog.inherits(goog.crypt.Sha512, goog.crypt.Sha2_64bit);454647/** @private {!Array<number>} */48goog.crypt.Sha512.INIT_HASH_BLOCK_ = [49// Section 5.3.5 of50// csrc.nist.gov/publications/fips/fips180-4/fips-180-4.pdf510x6a09e667, 0xf3bcc908, // H0520xbb67ae85, 0x84caa73b, // H1530x3c6ef372, 0xfe94f82b, // H2540xa54ff53a, 0x5f1d36f1, // H3550x510e527f, 0xade682d1, // H4560x9b05688c, 0x2b3e6c1f, // H5570x1f83d9ab, 0xfb41bd6b, // H6580x5be0cd19, 0x137e2179 // H759];606162