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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-24 16:49:05  来源:igfitidea点击:

Simple way of encrypting string in javascript?

javascriptencryption

提问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);

回答by Binary Brain

You can use the HTTPS Node.js Module.

您可以使用 HTTPS Node.js 模块。

Doc: http://nodejs.org/api/https.html

文档:http: //nodejs.org/api/https.html