bcrypt
1061 ワード
npm view bcrypt
https://github.com/kelektiv/node.bcrypt.js#readme npm install bcrypt
const bcrypt = require('bcrypt'); // import 하고
const saltRounds = 10; // 얼마나 많은 길이의 salt를 사용할 지 설정
const myPlaintextPassword = 's0/\/\P4$$w0rD';
const someOtherPlaintextPassword = 'not_bacon';
bcrypt.genSalt(saltRounds, function(err, salt) { // salt를 만들고 hash
bcrypt.hash(myPlaintextPassword, salt, function(err, hash) {
// Store hash in your password DB.
});
});
// Load hash from your password DB.
bcrypt.compare(myPlaintextPassword, hash, function(err, result) {
// result == true
});
bcrypt.compare(someOtherPlaintextPassword, hash, function(err, result) {
// result == false
});
Reference
この問題について(bcrypt), 我々は、より多くの情報をここで見つけました https://velog.io/@hyunjoong/bcryptテキストは自由に共有またはコピーできます。ただし、このドキュメントのURLは参考URLとして残しておいてください。
Collection and Share based on the CC Protocol