From e00ba096c8837abe85d366e0c1293c09dbe84d81 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Wed, 18 Aug 2021 03:29:15 -0400 Subject: Some bug fixes. --- stdlib/source/program/aedifex/hash.lux | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'stdlib/source/program/aedifex/hash.lux') 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 [ ] [(def: @@ -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) -- cgit v1.2.3