Skip to content

Instantly share code, notes, and snippets.

@esctabcapslock
Last active March 16, 2022 04:28
Show Gist options
  • Save esctabcapslock/f3e7258241bb3658ad8355eed087df57 to your computer and use it in GitHub Desktop.
Save esctabcapslock/f3e7258241bb3658ad8355eed087df57 to your computer and use it in GitHub Desktop.
해싱 (node.js)
const MD5 = (txt)=> crypto.createHash('md5').update(txt).digest('hex');
const SHA256 = (txt)=> crypto.createHash('sha256').update(txt).digest('hex');
const crypto = require('crypto');
const SHA512 = (txt)=>{
//creating hash object
const hash = crypto.createHash('sha512');
//passing the data to be hashed
const data = hash.update('bfg'+txt, 'utf-8');
//Creating the hash in the required format
const gen_hash= data.digest('hex');
//Printing the output on the console
return gen_hash;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment