diff options
author | Eduardo Julian | 2021-08-18 03:29:15 -0400 |
---|---|---|
committer | Eduardo Julian | 2021-08-18 03:29:15 -0400 |
commit | e00ba096c8837abe85d366e0c1293c09dbe84d81 (patch) | |
tree | dc1f0955d4461ae30bb4945cddd74c462f1aee98 /stdlib/source/program/aedifex/hash.lux | |
parent | 3289b9dcf9d5d1c1e5c380e3185065c8fd32535f (diff) |
Some bug fixes.
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/program/aedifex/hash.lux | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/stdlib/source/program/aedifex/hash.lux b/stdlib/source/program/aedifex/hash.lux index 63394c8c9..92414c441 100644 --- a/stdlib/source/program/aedifex/hash.lux +++ b/stdlib/source/program/aedifex/hash.lux @@ -31,10 +31,12 @@ (#static getInstance [java/lang/String] java/security/MessageDigest) (digest [[byte]] [byte])]) -(abstract: .public SHA-1 Any) -(abstract: .public MD5 Any) +(abstract: .public SHA-1 {} Any) +(abstract: .public MD5 {} Any) (abstract: .public (Hash h) + {} + Binary (def: .public data @@ -54,13 +56,13 @@ (def: encode (Format Binary) - (binary.fold (function (_ byte representation) - (let [hex (\ n.hex encode byte) - hex (case (text.size hex) - 1 (format "0" hex) - _ hex)] - (format representation hex))) - "")) + (binary.aggregate (function (_ byte representation) + (let [hex (\ n.hex encode byte) + hex (case (text.size hex) + 1 (format "0" hex) + _ hex)] + (format representation hex))) + "")) (template [<factor> <name>] [(def: <name> @@ -128,7 +130,7 @@ (do try.monad [head (\ n.hex decode head) output (binary.write/64! index head output)] - (recur tail (inc chunk) output)) + (recur tail (++ chunk) output)) #.None (case (..hash_size input) |