crypt.Hmac Extends goog.crypt.Hash
No description.

Inheritance

Constructor

goog.crypt.Hmac(hasherkeyopt_blockSize)

Parameters

hasher : !goog.crypt.Hash
An object to serve as a hash function.
key : Array.<number>
The secret key to use to calculate the hmac. Should be an array of not more than blockSize integers in {0, 255}.
opt_blockSize : number=
Optional. The block size hasher uses. If not specified, uses the block size from the hasher, or 16 if it is not specified.

Instance Methods

Public Protected Private
digest()
No description.
code »
getHmac(message) !Array.<number>
Calculates an HMAC for a given message.
Arguments:
message : Array.<number>
An array of integers in {0, 255}.
Returns: !Array.<number>  the digest of the given message.
code »
initialize_(key)
Initializes Hmac by precalculating the inner and outer paddings.
Arguments:
key : Array.<number>
The secret key to use to calculate the hmac. Should be an array of not more than blockSize integers in {0, 255}.
code »
reset()
No description.
code »
update()
No description.
code »
digest() !Array.<number>
No description.
Returns: !Array.<number>  The finalized hash computed from the internal accumulator.
code »
update(bytesopt_length)
Adds a byte array (array with values in [0-255] range) or a string (might only contain 8-bit, i.e., Latin1 characters) to the internal accumulator. Many hash functions operate on blocks of data and implement optimizations when a full chunk of data is readily available. Hence it is often preferable to provide large chunks of data (a kilobyte or more) than to repeatedly call the update method with few tens of bytes. If this is not possible, or not feasible, it might be good to provide data in multiplies of hash block size (often 64 bytes). Please see the implementation and performance tests of your favourite hash.
Arguments:
bytes : Array.<number> | Uint8Array | string
Data used for the update.
opt_length : number=
Number of bytes to use.
code »

Instance Properties

constructor :
No description.
Code »
hasher_ : goog.crypt.Hash
The underlying hasher to calculate hash.
Code »
keyI_ :
The inner padding array of hmac
Code »
keyO_ :
The outer padding array of hmac
Code »
blockSize :
The block size for the hasher.
Code »
reset :
Resets the internal accumulator.
Code »

Static Properties

goog.crypt.Hmac.IPAD_ :
Inner padding byte of HMAC algorith, per http://en.wikipedia.org/wiki/HMAC
Code »
goog.crypt.Hmac.OPAD_ :
Outer padding byte of HMAC algorith, per http://en.wikipedia.org/wiki/HMAC
Code »
goog.crypt.Hmac.superClass_ :
No description.
Code »

Package crypt

Package Reference