Javascript Hasher

From Yate Documentation
Jump to: navigation, search

Hasher handling object.

Constructor

  • new Hasher(type)

Parameters:
type: Hash type, one of 'md5', 'sha1', 'sha256'


Static methods

  • fips186prf(seed,len[,sep])

NIST FIPS 186-2 change notice 1 Pseudo Random Function.
Uses a b=160 bits SHA1 based G(t,c) function with no XSEEDj

Parameters:
seed: String, hexified data to use as RNG seed, must be 1 to 64 octets long
len: Numeric. Desired output length in octets, must be 1 to 512
sep: String, first character only. Desired separator for output string nibbles (bytes)
Return:
String (hexified output) on success, null on failure


Methods

  • update(data,isHex)

Update (append data to) hasher.

Parameters:
data: Data to append
isHex: Optional parameter. A boolean TRUE will indicate data is a hexified buffer
Return:
TRUE on success, FALSE on failure (data is invalid, the hasher is already finalized or any other error)

  • hmac(key,msg,isHex)

Compute a message authentication code with this hash. Finalize the hash if not already done.

Parameters:
key: Secret key
msg: Message to authenticate
isHex: Optional parameter. A boolean TRUE will indicate the key and msg are hexified buffers
Return:
TRUE on success, FALSE on failure (input data is invalid or any other error)

  • hexDigest()

Retrieve the standard hexadecimal representation of the hash. Finalize the hash if not already done.

Return:
Hexified string, empty if an error occurred.

  • clear()

Clear the hasher and prepare it for reuse.

  • finalize()

Finalize the hasher, make result ready. Subsequent updates will fail.

  • hashLength()

Retrieve the raw binary hash length.

Return:
Length of the hash in octets

  • hmacBlockSize()

Retrieve the size of the block used for HMAC calculations.

Return:
HMAC block size in octets

Personal tools
Namespaces

Variants
Actions
Preface
Configuration
Administrators
Developers