Path: blob/trunk/third_party/closure/goog/crypt/blockcipher.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 Interface definition of a block cipher. A block cipher is a16* pair of algorithms that implement encryption and decryption of input bytes.17*18* @see http://en.wikipedia.org/wiki/Block_cipher19*20* @author [email protected] (Nathan Naze)21*/2223goog.provide('goog.crypt.BlockCipher');24252627/**28* Interface definition for a block cipher.29* @interface30*/31goog.crypt.BlockCipher = function() {};3233/**34* Block size, in bytes.35* @type {number}36* @const37* @public38*/39goog.crypt.BlockCipher.prototype.BLOCK_SIZE;4041/**42* Encrypt a plaintext block. The implementation may expect (and assert)43* a particular block length.44* @param {!Array<number>|!Uint8Array} input Plaintext array of input bytes.45* @return {!Array<number>} Encrypted ciphertext array of bytes. Should be the46* same length as input.47*/48goog.crypt.BlockCipher.prototype.encrypt;495051/**52* Decrypt a plaintext block. The implementation may expect (and assert)53* a particular block length.54* @param {!Array<number>|!Uint8Array} input Ciphertext. Array of input bytes.55* @return {!Array<number>} Decrypted plaintext array of bytes. Should be the56* same length as input.57*/58goog.crypt.BlockCipher.prototype.decrypt;596061