ok-admin/pages/tripartite/okMd5.html

68 lines
2.0 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<!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>
<div class="ok-body">
<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>
</div>
<!--js逻辑-->
<script src="../../lib/layui/layui.js"></script>
<script>
layui.use(["code", "okMd5"], function () {
let code = layui.code;
let okMd5 = layui.okMd5;
code({
elem: 'pre',
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);
});
</script>
</body>
</html>