This repository has been archived on 2023-08-30. You can view files and clone it, but cannot push or open issues/pull-requests.
bytedo
/
wcui
Archived
1
0
Fork 0
wcui/js/lib/md5/Readme.md

28 lines
565 B
Markdown
Raw Normal View History

2017-03-30 01:40:59 +08:00
# md5 加密组件
可对普通字符串和文件计算其对应的md5值。
组件符合AMD规范, 可使用require引入
### demo:
```javascript
2017-09-08 22:45:02 +08:00
require(['./md5/main'], function(SparkMD5){
2017-03-30 01:40:59 +08:00
var Spark = new SparkMD5()
var md5 = function(cont){
return Spark.sign.call(Spark, cont)
}
var file = /*...*/ //文件表单获取
var fs = new FileReader() // Chrome, IE9+, FF, Safari
fs.readAsBinaryString(file)
fs.onload = function(){ // 计算该文件的md5签名
var sign = md5(this.result)
}
})
```