Methods
(static) hash(algorithm, message, inputEncoding, outputEncoding) → {string|Buffer}
Hash a given message using the specified hash algorithm.
Parameters:
Name | Type | Description |
---|---|---|
algorithm |
string
|
The hashing algorithm to be used. |
message |
Data
|
The message to be hashed. |
inputEncoding |
string
|
The encoding of the |
outputEncoding |
string
|
The encoding of the output. If encoding is provided a string will be returned; otherwise a Buffer is returned. |
Returns:
- Type:
-
string
|Buffer
The hash of the input message.
(async, static) hashStream(algorithm, input, inputEncoding, outputEncoding) → {Promise.<(string|Buffer)>}
Hash a message encapsulated inside a stream using the specified hash algorithm.
Parameters:
Name | Type | Description |
---|---|---|
algorithm |
string
|
The hashing algorithm to be used. |
input |
ReadableStream.<Data>
|
The stream containing the message to be hashed. |
inputEncoding |
string
|
The encoding of the |
outputEncoding |
string
|
The encoding of the output. If encoding is provided a string will be returned; otherwise a Buffer is returned. |
Returns:
- Type:
-
Promise.<(string|Buffer)>
The hash of the input message.