Build NapCat Artifacts / Windows Loader Test (push) Canceled after 0s
Build NapCat Artifacts / Type Check & Test (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Framework (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Shell (push) Canceled after 0s
13 lines
395 B
Plaintext
13 lines
395 B
Plaintext
import { isoCrypto, isoUint8Array } from './iso/index.js';
|
|
/**
|
|
* Returns hash digest of the given data, using the given algorithm when provided. Defaults to using
|
|
* SHA-256.
|
|
*/
|
|
export function toHash(data, algorithm = -7) {
|
|
if (typeof data === 'string') {
|
|
data = isoUint8Array.fromUTF8String(data);
|
|
}
|
|
const digest = isoCrypto.digest(data, algorithm);
|
|
return digest;
|
|
}
|