crypto#BinaryLike TypeScript Examples
The following examples show how to use
crypto#BinaryLike.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: index.ts From vite-electron-react-starter with MIT License | 6 votes |
/**
* Safe expose node.js API
* @example
* window.nodeCrypto('data')
*/
contextBridge.exposeInMainWorld('nodeCrypto', {
sha256sum(data: BinaryLike) {
const hash = createHash('sha256');
hash.update(data);
return hash.digest('hex');
},
});
Example #2
Source File: sha256.ts From octane with Apache License 2.0 | 5 votes |
// Hash some data with SHA-256
export function sha256(data: BinaryLike): Buffer {
return createHash('sha256').update(data).digest();
}