Mercurial > prosody-hg
comparison spec/util_hashes_spec.lua @ 12564:36e769c64054
util.hashes: Add SHA3 bindings
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Thu, 10 Sep 2020 21:58:24 +0200 |
| parents | a0ff5c438e9d |
| children | dbe9781fd278 |
comparison
equal
deleted
inserted
replaced
| 12563:d9a4e28689eb | 12564:36e769c64054 |
|---|---|
| 51 assert.equal(DK, hex.encode(hashes.pbkdf2_hmac_sha256(P, S, c))); | 51 assert.equal(DK, hex.encode(hashes.pbkdf2_hmac_sha256(P, S, c))); |
| 52 end); | 52 end); |
| 53 end); | 53 end); |
| 54 | 54 |
| 55 | 55 |
| 56 describe("SHA-3", function () | |
| 57 describe("256", function () | |
| 58 it("works", function () | |
| 59 local expected = "a7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a" | |
| 60 assert.equal(expected, hashes.sha3_256("", true)); | |
| 61 end); | |
| 62 end); | |
| 63 describe("512", function () | |
| 64 it("works", function () | |
| 65 local expected = "a69f73cca23a9ac5c8b567dc185a756e97c982164fe25859e0d1dcc1475c80a615b2123af1f5f94c11e3e9402c3ac558f500199d95b6d3e301758586281dcd26" | |
| 66 assert.equal(expected, hashes.sha3_512("", true)); | |
| 67 end); | |
| 68 end); | |
| 69 end); | |
| 70 |
