Javascript 在javascript中加密字符串的简单方法?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14449836/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Simple way of encrypting string in javascript?
提问by cjoh
I want to send information between my client and NodeJS server. I need a simpleway of encrypting messages from the client.
我想在我的客户端和 NodeJS 服务器之间发送信息。我需要一种加密来自客户端的消息的简单方法。
I've tried: http://javascript.about.com/library/blencrypt.htm
我试过:http: //javascript.about.com/library/blencrypt.htm
but I need something simpler
但我需要更简单的东西
回答by imdrupal
Have you tried http://crypto.stanford.edu/sjcl/?
你试过http://crypto.stanford.edu/sjcl/吗?
Very simple to use,
使用非常简单,
var sensitiveInfo = "yodawgpasswords";
var encryptedInfo = sjcl.encrypt("password", sensitiveInfo);
var decryptedInfo = sjcl.decrypt("password", encryptedInfo);

