Namespace: hmac

md5.hmac

Source:

Methods

(static) array(key, message) → {Array}

Output hash as bytes array
Parameters:
Name Type Description
key String | Array | Uint8Array | ArrayBuffer key
message String | Array | Uint8Array | ArrayBuffer message to hash
Source:
Returns:
Bytes array
Type
Array
Example
md5.hmac.array('key', 'The quick brown fox jumps over the lazy dog');

(static) arrayBuffer(key, message) → {ArrayBuffer}

Output hash as ArrayBuffer
Parameters:
Name Type Description
key String | Array | Uint8Array | ArrayBuffer key
message String | Array | Uint8Array | ArrayBuffer message to hash
Source:
Returns:
ArrayBuffer
Type
ArrayBuffer
Example
md5.hmac.arrayBuffer('key', 'The quick brown fox jumps over the lazy dog');

(static) base64(key, message) → {String}

Output hash as base64 string
Parameters:
Name Type Description
key String | Array | Uint8Array | ArrayBuffer key
message String | Array | Uint8Array | ArrayBuffer message to hash
Source:
Returns:
base64 string
Type
String
Example
md5.hmac.base64('key', 'The quick brown fox jumps over the lazy dog');

(static) buffer(key, message) → {ArrayBuffer}

Output hash as ArrayBuffer
Parameters:
Name Type Description
key String | Array | Uint8Array | ArrayBuffer key
message String | Array | Uint8Array | ArrayBuffer message to hash
Deprecated:
  • This maybe confuse with Buffer in node.js. Please use arrayBuffer instead.
Source:
Returns:
ArrayBuffer
Type
ArrayBuffer
Example
md5.hmac.buffer('key', 'The quick brown fox jumps over the lazy dog');

(static) create(key) → {HmacMd5}

Create HmacMd5 object
Parameters:
Name Type Description
key String | Array | Uint8Array | ArrayBuffer key
Source:
Returns:
HmacMd5 object.
Type
HmacMd5
Example
var hash = md5.hmac.create('key');

(static) digest(key, message) → {Array}

Output hash as bytes array
Parameters:
Name Type Description
key String | Array | Uint8Array | ArrayBuffer key
message String | Array | Uint8Array | ArrayBuffer message to hash
Source:
Returns:
Bytes array
Type
Array
Example
md5.hmac.digest('key', 'The quick brown fox jumps over the lazy dog');

(static) hex(key, message) → {String}

Output hash as hex string
Parameters:
Name Type Description
key String | Array | Uint8Array | ArrayBuffer key
message String | Array | Uint8Array | ArrayBuffer message to hash
Source:
Returns:
Hex string
Type
String
Example
md5.hmac.hex('key', 'The quick brown fox jumps over the lazy dog');
// equal to
md5.hmac('key', 'The quick brown fox jumps over the lazy dog');

(static) update(key, message) → {HmacMd5}

Create and update HmacMd5 object
Parameters:
Name Type Description
key String | Array | Uint8Array | ArrayBuffer key
message String | Array | Uint8Array | ArrayBuffer message to hash
Source:
Returns:
HmacMd5 object.
Type
HmacMd5
Example
var hash = md5.hmac.update('key', 'The quick brown fox jumps over the lazy dog');
// equal to
var hash = md5.hmac.create('key');
hash.update('The quick brown fox jumps over the lazy dog');