forked from kjur/jsrsasign
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathqunit-do-crypto-md.html
63 lines (53 loc) · 2.14 KB
/
qunit-do-crypto-md.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>QUnit for KJUR.crypto.MessageDigest</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<script type="text/javascript" src="jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="qunit.js"></script>
<link rel="stylesheet" href="qunit.css" type="text/css" media="screen" />
<script src="../jsrsasign-all-min.js"></script>
<script src="../src/crypto-1.1.js"></script>
<script src="../ext/rsa.js"></script>
<script src="../ext/rsa2.js"></script>
<script type="text/javascript">
$(document).ready(function(){
test("KJUR.crypto.MessageDigest.getCanonicalAlgName", function() {
var MD = KJUR.crypto.MessageDigest;
equal(MD.getCanonicalAlgName("sha1"), "sha1", "sha1 > sha1");
equal(MD.getCanonicalAlgName("SHA1"), "sha1", "SHA1 > sha1");
equal(MD.getCanonicalAlgName("SHA-1"), "sha1", "SHA-1 > sha1");
equal(MD.getCanonicalAlgName("SHA-256"), "sha256", "SHA-256 > sha256");
});
test("KJUR.crypto.MessageDigest.HASHLENGTH", function() {
var MD = KJUR.crypto.MessageDigest;
equal(MD.HASHLENGTH["md5"], 16, "md5 > 16");
equal(MD.HASHLENGTH["sha1"], 20, "sha1 > 20");
equal(MD.HASHLENGTH["sha256"], 32, "sha256 > 32");
equal(MD.HASHLENGTH["sha512"], 64, "sha512 > 64");
equal(MD.HASHLENGTH["ripemd160"], 20, "ripemd160 > 20");
});
test("KJUR.crypto.MessageDigest.getHashLength", function() {
var MD = KJUR.crypto.MessageDigest;
equal(MD.getHashLength("sha1"), 20, "sha1 > 20");
equal(MD.getHashLength("SHA1"), 20, "SHA1 > 20");
equal(MD.getHashLength("SHA-1"), 20, "SHA-1 > 20");
equal(MD.getHashLength("SHA-256"), 32, "SHA-256 > 32");
});
test("KJUR.crypto.MessageDigest.digest sha1", function() {
var md = new KJUR.crypto.MessageDigest({alg: "sha1"});
md.updateString("aaa");
equal(md.digest(), "7e240de74fb1ed08fa08d38063f6a6a91462a815", "sha1(aaa) = 7e24...");
});
});
</script>
</head>
<body>
<div id="qunit"></div>
<div id="qunit-fixture">test markup</div>
QUnit for
<a href="index.html">INDEX</a> |
</body>
<center><p>© 2016 Kenji Urushima</p></center>
</html>