Programming/Node.js

Node.js 노드 내장 모듈 cryoto

통통만두 2018. 10. 1. 16:59
반응형

노드 10.11.0 버전을 사용중에 있습니다. 노드 내장 모듈 중에는 암호화를 할 수 있는 crypto 라는 모듈이 있습니다. 이 모듈을 사용하면 손쉽게 hash값을 얻거나 단방향, 양방향 암호를 할 수 있습니다.

const crypto = require('crypto');

console.log( `base64 : ${ crypto.createHash('sha512').update('marsland@hanmail.net').digest('base64') }` );
console.log( `hex : ${ crypto.createHash('sha512').update('marsland@hanmail.net').digest('hex') }` );


참고


반응형