Quellcode durchsuchen

added unit tests

Sam MacPherson vor 11 Jahren
Ursprung
Commit
a34005b8b8

+ 11 - 0
tests/unit/unitstd/haxe/crypto/Hmac.unit.hx

@@ -0,0 +1,11 @@
+var hmacMd5 = new haxe.crypto.Hmac(MD5);
+var hmacSha1 = new haxe.crypto.Hmac(SHA1);
+var hmacSha256 = new haxe.crypto.Hmac(SHA256);
+
+hmacMd5.encode(haxe.io.Bytes.ofString(""), haxe.io.Bytes.ofString("")).toHex() == "74e6f7298a9c2d168935f58c001bad88";
+hmacSha1.encode(haxe.io.Bytes.ofString(""), haxe.io.Bytes.ofString("")).toHex() == "fbdb1d1b18aa6c08324b7d64b71fb76370690e1d";
+hmacSha256.encode(haxe.io.Bytes.ofString(""), haxe.io.Bytes.ofString("")).toHex() == "b613679a0814d9ec772f95d778c35fc5ff1697c493715653c6c712144292c5ad";
+
+hmacMd5.encode(haxe.io.Bytes.ofString("key"), haxe.io.Bytes.ofString("The quick brown fox jumps over the lazy dog")).toHex() == "80070713463e7749b90c2dc24911e275";
+hmacSha1.encode(haxe.io.Bytes.ofString("key"), haxe.io.Bytes.ofString("The quick brown fox jumps over the lazy dog")).toHex() == "de7c9b85b8b78aa6bc8a7a36f70a90701c9db4d9";
+hmacSha256.encode(haxe.io.Bytes.ofString("key"), haxe.io.Bytes.ofString("The quick brown fox jumps over the lazy dog")).toHex() == "f7bc83f430538424b13298e6aa6fb143ef4d59a14946175997479dbc2d1a3cd8";

+ 2 - 0
tests/unit/unitstd/haxe/crypto/Md5.unit.hx

@@ -0,0 +1,2 @@
+haxe.crypto.Md5.encode("") == "d41d8cd98f00b204e9800998ecf8427e";
+haxe.crypto.Md5.encode("The quick brown fox jumps over the lazy dog") == "9e107d9d372bb6826bd81d3542a419d6";

+ 2 - 0
tests/unit/unitstd/haxe/crypto/Sha1.unit.hx

@@ -0,0 +1,2 @@
+haxe.crypto.Sha1.encode("") == "da39a3ee5e6b4b0d3255bfef95601890afd80709";
+haxe.crypto.Sha1.encode("The quick brown fox jumps over the lazy dog") == "2fd4e1c67a2d28fced849ee1bb76e7391b93eb12";

+ 2 - 0
tests/unit/unitstd/haxe/crypto/Sha256.unit.hx

@@ -0,0 +1,2 @@
+haxe.crypto.Sha256.encode("") == "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";
+haxe.crypto.Sha256.encode("The quick brown fox jumps over the lazy dog") == "d7a8fbb307d7809469ca9abcb0082e4f8d5651e46d3cdb762d02d0bf37c9e592";