aboutsummaryrefslogtreecommitdiffstats
path: root/spec/util_hashes_spec.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2022-03-04 15:22:45 +0000
committerMatthew Wild <mwild1@gmail.com>2022-03-04 15:22:45 +0000
commitab835fed13e300b3a49131296917f5038eb6c06c (patch)
treea55d78e6ff4e53a8ccbdd6d9e8d7509a3a7f3133 /spec/util_hashes_spec.lua
parentfe56effa55147a7deb8ee754c092af899e662c73 (diff)
downloadprosody-ab835fed13e300b3a49131296917f5038eb6c06c.tar.gz
prosody-ab835fed13e300b3a49131296917f5038eb6c06c.zip
util.hex: Deprecate to/from in favour of encode/decode, for consistency!
Diffstat (limited to 'spec/util_hashes_spec.lua')
-rw-r--r--spec/util_hashes_spec.lua12
1 files changed, 6 insertions, 6 deletions
diff --git a/spec/util_hashes_spec.lua b/spec/util_hashes_spec.lua
index 3639dd4e..51a4a79c 100644
--- a/spec/util_hashes_spec.lua
+++ b/spec/util_hashes_spec.lua
@@ -10,28 +10,28 @@ describe("PBKDF2-HMAC-SHA1", function ()
local S = "salt"
local c = 1
local DK = "0c60c80f961f0e71f3a9b524af6012062fe037a6";
- assert.equal(DK, hex.to(hashes.pbkdf2_hmac_sha1(P, S, c)));
+ assert.equal(DK, hex.encode(hashes.pbkdf2_hmac_sha1(P, S, c)));
end);
it("test vector 2", function ()
local P = "password"
local S = "salt"
local c = 2
local DK = "ea6c014dc72d6f8ccd1ed92ace1d41f0d8de8957";
- assert.equal(DK, hex.to(hashes.pbkdf2_hmac_sha1(P, S, c)));
+ assert.equal(DK, hex.encode(hashes.pbkdf2_hmac_sha1(P, S, c)));
end);
it("test vector 3", function ()
local P = "password"
local S = "salt"
local c = 4096
local DK = "4b007901b765489abead49d926f721d065a429c1";
- assert.equal(DK, hex.to(hashes.pbkdf2_hmac_sha1(P, S, c)));
+ assert.equal(DK, hex.encode(hashes.pbkdf2_hmac_sha1(P, S, c)));
end);
it("test vector 4 #SLOW", function ()
local P = "password"
local S = "salt"
local c = 16777216
local DK = "eefe3d61cd4da4e4e9945b3d6ba2158c2634e984";
- assert.equal(DK, hex.to(hashes.pbkdf2_hmac_sha1(P, S, c)));
+ assert.equal(DK, hex.encode(hashes.pbkdf2_hmac_sha1(P, S, c)));
end);
end);
@@ -41,14 +41,14 @@ describe("PBKDF2-HMAC-SHA256", function ()
local S = "salt";
local c = 1
local DK = "120fb6cffcf8b32c43e7225256c4f837a86548c92ccc35480805987cb70be17b";
- assert.equal(DK, hex.to(hashes.pbkdf2_hmac_sha256(P, S, c)));
+ assert.equal(DK, hex.encode(hashes.pbkdf2_hmac_sha256(P, S, c)));
end);
it("test vector 2", function ()
local P = "password";
local S = "salt";
local c = 2
local DK = "ae4d0c95af6b46d32d0adff928f06dd02a303f8ef3c251dfd6e2d85a95474c43";
- assert.equal(DK, hex.to(hashes.pbkdf2_hmac_sha256(P, S, c)));
+ assert.equal(DK, hex.encode(hashes.pbkdf2_hmac_sha256(P, S, c)));
end);
end);