Giter Site home page Giter Site logo

js_md5's Introduction

js_md5

js_md5加密密码, node后台使用crypto加密密码

为什么在传输过程中要用md5对密码进行加密?

众所周知,我们在表单中的输入框输入了密码后,如果采用ajax的post或者get方式提交数据,在浏览器的newwork中就可以看到我们向后台传输的内容,其他的文本内容直接提交都没问题,如果密码在传输的过程中也能被别人看见。

如果传输被拦截,那么密码就完全暴露给别人了,安全性存在极大的隐患。

所以,在传输过程中,推荐使用加密传输。

使用前提

==安装了nodejs 的koa 框架==

如果没有安装koa,请执行以下命令

npm install -g koa-generator

什么是koa?
如何学习koa?

使用方法

> 进入项目根目录
> npm install
> npm start

访问方式

http://localhost:3000

前端单个js_md5实例代码

<!DOCTYPE HTML>
<html>
	<head>
	<meta charset="utf-8">
	<title>md5加密</title>
	<script type="text/ecmascript" src="md5.js"></script>
	<script type="text/javascript">
	 var hash = hex_md5("123dafd");
	 alert(hash)
	</script>
</head>
<body>
</body>
</html>

前端md5加密参考文档

服务端单个md5加密代码

var crypto = require('crypto');
exports.md5 = function (str) {
	var md5sum = crypto.createHash(‘md5’);
	md5sum.update(str);
	str = md5sum.digest(‘hex’);
	return str;
};

服务端md5加密参考

js_md5's People

Contributors

xiangming25 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.