ok-admin/pages/tripartite/okMd5.html

68 lines
2.0 KiB
HTML
Raw Normal View History

2019-11-01 08:00:26 +00:00
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>okMd5</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="stylesheet" href="../../css/oksub.css">
</head>
<body>
2019-11-01 13:29:30 +00:00
<div class="ok-body">
2019-11-02 05:46:43 +00:00
<blockquote class="layui-elem-quote">
<p>JavaScript版本的MD5实现</p>
</blockquote>
<pre>
layui.use(["okMd5"], function () {
let okMd5 = layui.okMd5;
<br/>
// 计算给定字符串值的十六进制编码的MD5哈希值
let hash = okMd5("hello");
console.log(hash);
// 计算给定字符串值和key的十六进制编码的HMAC-MD5哈希值
let hash2 = okMd5("hello", "word");
console.log(hash2);
// 计算给定字符串值的原始MD5哈希值
let hash3 = okMd5("hello", null, true)
console.log(hash3);
// 计算给定字符串值和key的原始HMAC-MD5哈希值
let hash4 = okMd5("hello", "word", true)
console.log(hash4);
});
</pre>
2019-11-01 13:29:30 +00:00
</div>
<!--js逻辑-->
<script src="../../lib/layui/layui.js"></script>
<script>
2019-11-02 05:46:43 +00:00
layui.use(["code", "okMd5"], function () {
let code = layui.code;
2019-11-02 04:02:23 +00:00
let okMd5 = layui.okMd5;
2019-11-02 05:46:43 +00:00
code({
2019-11-02 06:03:43 +00:00
elem: "pre",
2019-11-02 05:46:43 +00:00
title: "代码示例"
});
// 计算给定字符串值的十六进制编码的MD5哈希值
let hash = okMd5("hello");
console.log(hash);
// 计算给定字符串值和key的十六进制编码的HMAC-MD5哈希值
let hash2 = okMd5("hello", "word");
console.log(hash2);
// 计算给定字符串值的原始MD5哈希值
let hash3 = okMd5("hello", null, true)
console.log(hash3);
// 计算给定字符串值和key的原始HMAC-MD5哈希值
let hash4 = okMd5("hello", "word", true)
console.log(hash4);
2019-11-01 13:29:30 +00:00
});
</script>
2019-11-01 08:00:26 +00:00
</body>
</html>