Last active
December 17, 2016 22:51
-
-
Save samverneck/d79fa327d196bb672253cfd1fa6f5090 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var crypto = require('crypto'); | |
crypto.randomBytes(tamanho, function (erro, resultado ) { | |
if (erro) {throw erro;} | |
console.log('Uma string aleatória de %d bytes: %s', resultado .length, resultado); | |
}); | |
// ======== | |
// crypto node.js | |
const crypto = require('crypto'); | |
const secret = 'abcdefg'; | |
const hash = crypto.createHmac('sha256', secret) | |
// mensagem aqui em baixo | |
.update('Tente descobrir se for capaz seu') | |
.digest('hex'); | |
console.log(hash); | |
// imprimindo | |
// carregando... | |
//aqui está sua mensagem | |
// cd3046921599d7e5aa6f61bbe6560bb748cc3c4a67d8d11816a66d6e45e0663e | |
const crypto = require('crypto'); | |
const secret = 'abcdefg'; | |
const hash = crypto.createHmac('md5', secret) | |
.update('Tente descobrir se for capaz seu') | |
.digest('hex'); | |
console.log(hash); | |
// imprimindo | |
// carregando... | |
//aqui está sua mensagem | |
// 4334d64e25c0934e6f36de1b3c638e03 |
teve up no codigo agora com MD5
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
crypto node.js utilizei o node,js.
haha
para estudos: https://nodejs.org/docs/v7.1.0/api/crypto.html#crypto_crypto