Javascript Hasher

From Yate Documentation
Revision as of 15:41, 11 June 2014 by Marian (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Hasher handling object.

Constructor

  • new Hasher(type)

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

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