node 使用utility实现字符串加密

使用utility第三方模块实现对字符串的加密

utility有两个很重要的方法,一个是sha1,一个是md5,通常使用他们对字符串进行加密处理。

pm install utility --save

app.js 

var express=require("express");
var utility=require("utility");
var app=express();

app.get("/",function(req,resp){
    var name=req.query.name;
    console.log("receive name info:"+name);
    var sha1Value=utility.sha1(name);
    resp.send("your name is :"+sha1Value);
});

app.listen(3000,function(){
    console.log("server is running");    
});

猜你喜欢

转载自blog.csdn.net/weixin_41111068/article/details/87925232