Path: blob/trunk/third_party/closure/goog/crypt/sha256.js
2868 views
// Copyright 2012 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-256 cryptographic hash.16*17* Usage:18* var sha256 = new goog.crypt.Sha256();19* sha256.update(bytes);20* var hash = sha256.digest();21*22*/2324goog.provide('goog.crypt.Sha256');2526goog.require('goog.crypt.Sha2');27282930/**31* SHA-256 cryptographic hash constructor.32*33* @constructor34* @extends {goog.crypt.Sha2}35* @final36* @struct37*/38goog.crypt.Sha256 = function() {39goog.crypt.Sha256.base(40this, 'constructor', 8, goog.crypt.Sha256.INIT_HASH_BLOCK_);41};42goog.inherits(goog.crypt.Sha256, goog.crypt.Sha2);434445/** @private {!Array<number>} */46goog.crypt.Sha256.INIT_HASH_BLOCK_ = [470x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c,480x1f83d9ab, 0x5be0cd1949];505152