aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/program/aedifex/hash.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/program/aedifex/hash.lux')
-rw-r--r--stdlib/source/program/aedifex/hash.lux22
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)