diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/program/aedifex/hash.lux | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/stdlib/source/program/aedifex/hash.lux b/stdlib/source/program/aedifex/hash.lux index 92414c441..74e78ca55 100644 --- a/stdlib/source/program/aedifex/hash.lux +++ b/stdlib/source/program/aedifex/hash.lux @@ -54,10 +54,10 @@ [md5 ..MD5 "MD5"] ) - (def: encode + (def: encoded (Format Binary) (binary.aggregate (function (_ byte representation) - (let [hex (\ n.hex encode byte) + (let [hex (\ n.hex encoded byte) hex (case (text.size hex) 1 (format "0" hex) _ hex)] @@ -88,7 +88,7 @@ (template [<name> <size>] [(exception: .public (<name> {data Binary}) (exception.report - ["Pseudo hash" (%.text (..encode data))] + ["Pseudo hash" (%.text (..encoded data))] ["Expected size" (%.nat <size>)] ["Actual size" (%.nat (binary.size data))]))] @@ -115,7 +115,7 @@ (-> Nat Nat) (n.* ..hex_per_byte)) - (def: (decode size constructor encoded) + (def: (decoded size constructor encoded) (All [h] (-> Nat (-> Binary (Try (Hash h))) (-> Text (Try (Hash h))))) @@ -128,7 +128,7 @@ (case (text.split_at ..hex_per_chunk input) (#.Some [head tail]) (do try.monad - [head (\ n.hex decode head) + [head (\ n.hex decoded head) output (binary.write/64! index head output)] (recur tail (++ chunk) output)) @@ -138,7 +138,7 @@ (^template [<size> <write>] [<size> (do try.monad - [head (\ n.hex decode input) + [head (\ n.hex decoded input) output (<write> index head output)] (constructor output))]) ([1 binary.write/8!] @@ -151,8 +151,8 @@ [(implementation: .public <codec> (Codec Text (Hash <hash>)) - (def: encode (|>> :representation ..encode)) - (def: decode (..decode <nat> <constructor>)))] + (def: encoded (|>> :representation ..encoded)) + (def: decoded (..decoded <nat> <constructor>)))] [sha-1_codec SHA-1 ..sha-1::size ..as_sha-1] [md5_codec MD5 ..md5::size ..as_md5] |