const crypto = require('crypto');
//将回调函数转化为promise对象,提高运行效率
const pbkdf2Async = require('bluebird').promisify(crypto.pbkdf2)
router.get('/login',function (req,res,next) {
(async ()=>{
const {username,password} = req.body;
//cipher为加密后的密码
const cipher = await pbkdf2Async(password,'sjdjadijsas',10000,512,'sha256').then();
res.send(cipher)
})()
.then(r => {
console.log(r)
})
.catch(e => {
console.log(e)
})
});