chore: method signatures for sha256 method
This commit is contained in:
parent
12ef2f4465
commit
836bd9ab3c
1 changed files with 7 additions and 2 deletions
|
|
@ -84,8 +84,13 @@ const generateRandomString = () => {
|
|||
window.crypto.getRandomValues(array);
|
||||
return Array.from(array, dec => `0${dec.toString(16)}`.substr(-2)).join("");
|
||||
};
|
||||
// Calculate the SHA256 hash of the input text.
|
||||
// Returns a promise that resolves to an ArrayBuffer
|
||||
|
||||
/**
|
||||
* Calculate the SHA256 hash of the input text
|
||||
*
|
||||
* @returns {Promise<ArrayBuffer>}
|
||||
*/
|
||||
|
||||
const sha256 = plain => {
|
||||
const encoder = new TextEncoder();
|
||||
const data = encoder.encode(plain);
|
||||
|
|
|
|||
Loading…
Reference in a new issue