Skip to content

Instantly share code, notes, and snippets.

@SangHakLee
Last active June 27, 2017 16:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SangHakLee/04431a9b38f4cbe62d7de0416a5983fd to your computer and use it in GitHub Desktop.
Save SangHakLee/04431a9b38f4cbe62d7de0416a5983fd to your computer and use it in GitHub Desktop.
DES 암호화
const crypto = require('crypto')
/**
*
* @param {String} plaintext (64bit 8Byte)
* @param {String} key (56bit 7Byte)
*
* @return {String} ciphertext
*/
const DES = (plaintext, key) => {
let cipher = crypto.createCipher('des', key)
let ciphertext = cipher.update(plaintext, 'utf8', 'hex')
ciphertext += cipher.final('hex')
return ciphertext
}
console.log( DES('hak', '1234567') ) //
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment