crypt.Sha2_64bit Extends goog.crypt.Hash
Constructs a SHA-2 64-bit cryptographic hash. This class should not be used. Rather, one should use one of its subclasses.

Inheritance

Constructor

goog.crypt.Sha2_64bit(numHashBlocksinitHashBlocks)

Parameters

numHashBlocks : number
The size of the output in 16-byte blocks
initHashBlocks : !Array.<number>
The hash-specific initialization vector, as a sequence of sixteen 32-bit numbers.

Instance Methods

Public Protected Private
Sigma0_(value) !goog.math.Long
Calculates the SHA2 64-bit Sigma0 function. rotateRight(value, 28) ^ rotateRight(value, 34) ^ rotateRight(value, 39)
Arguments:
value : !goog.math.Long
No description.
Returns: !goog.math.Long  No description.
code »
Sigma1_(value) !goog.math.Long
Calculates the SHA2 64-bit Sigma1 function. rotateRight(value, 14) ^ rotateRight(value, 18) ^ rotateRight(value, 41)
Arguments:
value : !goog.math.Long
No description.
Returns: !goog.math.Long  No description.
code »
choose_(valueonetwo) !goog.math.Long
Calculates the SHA-2 64-bit choose function. This function uses value as a mask to choose bits from either one if the bit is set or two if the bit is not set.
Arguments:
value : !goog.math.Long
No description.
one : !goog.math.Long
No description.
two : !goog.math.Long
No description.
Returns: !goog.math.Long  No description.
code »
computeChunk_()
Updates this hash by processing the 1024-bit message chunk in this.chunk_.
code »
digest()
No description.
code »
majority_(onetwothree) !goog.math.Long
Calculates the SHA-2 64-bit majority function. This function returns, for each bit position, the bit held by the majority of its three arguments.
Arguments:
one : !goog.math.Long
No description.
two : !goog.math.Long
No description.
three : !goog.math.Long
No description.
Returns: !goog.math.Long  No description.
code »
reset()
Resets this hash function.
code »
sigma0_(value) !goog.math.Long
Calculates the SHA2 64-bit sigma0 function. rotateRight(value, 1) ^ rotateRight(value, 8) ^ (value >>> 7)
Arguments:
value : !goog.math.Long
No description.
Returns: !goog.math.Long  No description.
code »
sigma1_(value) !goog.math.Long
Calculates the SHA2 64-bit sigma1 function. rotateRight(value, 19) ^ rotateRight(value, 61) ^ (value >>> 6)
Arguments:
value : !goog.math.Long
No description.
Returns: !goog.math.Long  No description.
code »
sum_(onetwovar_args) !goog.math.Long
Adds two or more goog.math.Long values.
Arguments:
one : !goog.math.Long
first summand
two : !goog.math.Long
second summand
var_args : ...goog.math.Long
more arguments to sum
Returns: !goog.math.Long  The resulting sum.
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

blockSize :
The number of bytes that are digested in each pass of this hasher.
Code »
chunkBytes_ :
Current number of bytes in this.chunk_.
Code »
chunk_ :
A chunk holding the currently processed message bytes. Once the chunk has this.blocksize bytes, we feed it into [@code computeChunk_}.
Code »
constructor :
No description.
Code »
hash_ :
Holds the previous values of accumulated hash a-h in the computeChunk_ function.
Code »
initHashBlocks_ :
The value to which this.hash_ should be reset when this Hasher is reset.
Code »
needsReset_ :
If true, we have taken the digest from this hasher, but we have not yet reset it.
Code »
numHashBlocks_ :
The number of blocks of output produced by this hash function, where each block is eight bytes long.
Code »
total_ :
Total number of bytes in currently processed message.
Code »
w_ :
Temporary array used in chunk computation. Allocate here as a member rather than as a local within computeChunk_() as a performance optimization to reduce the number of allocations and reduce garbage collection.
Code »
blockSize :
The block size for the hasher.
Code »
reset :
Resets the internal accumulator.
Code »

Static Methods

goog.crypt.Sha2_64bit.toLongArray_(values) !Array.<!goog.math.Long>
Converts an array of 32-bit integers into an array of goog.math.Long elements.
Arguments:
values : !Array.<number>
An array of 32-bit numbers. Its length must be even. Each pair of numbers represents a 64-bit integer in big-endian order
Returns: !Array.<!goog.math.LongNo description.
code »

Static Properties

goog.crypt.Sha2_64bit.BLOCK_SIZE_ :
The number of bytes that are digested in each pass of this hasher.
Code »
goog.crypt.Sha2_64bit.K_ :
Fixed constants used in SHA-512 variants. These values are from Section 4.2.3 of http://csrc.nist.gov/publications/fips/fips180-4/fips-180-4.pdf
Code »
goog.crypt.Sha2_64bit.PADDING_ :
Contains data needed to pad messages less than blocksize bytes.
Code »
goog.crypt.Sha2_64bit.superClass_ :
No description.
Code »

Package crypt

Package Reference