13 lines
279 B
JavaScript
13 lines
279 B
JavaScript
"use strict";
|
|
const crypto = require('crypto');
|
|
/**
|
|
* Convert string to sha256 string in hex
|
|
* @param {*} text
|
|
* @returns
|
|
*/
|
|
function toSha256( text ){
|
|
return crypto.createHmac( "sha256" , "" ).update( text ).digest( 'hex' );
|
|
}
|
|
|
|
module.exports = { toSha256 };
|