浏览代码

changed encode to make for consistancy

Sam MacPherson 11 年之前
父节点
当前提交
dd52de848d
共有 2 个文件被更改,包括 7 次插入7 次删除
  1. 1 1
      std/haxe/crypto/Hmac.hx
  2. 6 6
      tests/unit/unitstd/haxe/crypto/Hmac.unit.hx

+ 1 - 1
std/haxe/crypto/Hmac.hx

@@ -64,7 +64,7 @@ class Hmac {
 		return sb.getBytes();
 	}
 	
-	public function encode( key : haxe.io.Bytes, msg : haxe.io.Bytes ) : haxe.io.Bytes {
+	public function make( key : haxe.io.Bytes, msg : haxe.io.Bytes ) : haxe.io.Bytes {
 		if(key.length > blockSize) {
 			key = doHash(key);
 		}

+ 6 - 6
tests/unit/unitstd/haxe/crypto/Hmac.unit.hx

@@ -2,10 +2,10 @@ 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.make(haxe.io.Bytes.ofString(""), haxe.io.Bytes.ofString("")).toHex() == "74e6f7298a9c2d168935f58c001bad88";
+hmacSha1.make(haxe.io.Bytes.ofString(""), haxe.io.Bytes.ofString("")).toHex() == "fbdb1d1b18aa6c08324b7d64b71fb76370690e1d";
+hmacSha256.make(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";
+hmacMd5.make(haxe.io.Bytes.ofString("key"), haxe.io.Bytes.ofString("The quick brown fox jumps over the lazy dog")).toHex() == "80070713463e7749b90c2dc24911e275";
+hmacSha1.make(haxe.io.Bytes.ofString("key"), haxe.io.Bytes.ofString("The quick brown fox jumps over the lazy dog")).toHex() == "de7c9b85b8b78aa6bc8a7a36f70a90701c9db4d9";
+hmacSha256.make(haxe.io.Bytes.ofString("key"), haxe.io.Bytes.ofString("The quick brown fox jumps over the lazy dog")).toHex() == "f7bc83f430538424b13298e6aa6fb143ef4d59a14946175997479dbc2d1a3cd8";