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.lux30
1 files changed, 15 insertions, 15 deletions
diff --git a/stdlib/source/program/aedifex/hash.lux b/stdlib/source/program/aedifex/hash.lux
index 7a2668bc7..5d5890c3a 100644
--- a/stdlib/source/program/aedifex/hash.lux
+++ b/stdlib/source/program/aedifex/hash.lux
@@ -40,12 +40,12 @@
(primitive .public (Hash h)
Binary
- (def: .public data
+ (def .public data
(All (_ h) (-> (Hash h) Binary))
(|>> representation))
(with_template [<name> <kind> <algorithm>]
- [(def: .public (<name> value)
+ [(def .public (<name> value)
(-> Binary (Hash <kind>))
(|> (java/security/MessageDigest::getInstance [(ffi.as_string <algorithm>)])
(java/security/MessageDigest::digest [value])
@@ -55,7 +55,7 @@
[md5 ..MD5 "MD5"]
)
- (def: encoded
+ (def encoded
(Format Binary)
(binary.mix (function (_ byte representation)
(let [hex (at n.hex encoded byte)
@@ -66,7 +66,7 @@
""))
(with_template [<factor> <name>]
- [(def: <name>
+ [(def <name>
Nat
<factor>)]
@@ -74,10 +74,10 @@
[16 md5::size]
)
- (def: hex_per_byte
+ (def hex_per_byte
2)
- (def: hex_per_chunk
+ (def hex_per_chunk
(n.* hex_per_byte i64.bytes_per_i64))
(exception: .public (not_a_hash [size Nat
@@ -99,7 +99,7 @@
)
(with_template [<name> <kind> <size> <exception>]
- [(def: .public (<name> data)
+ [(def .public (<name> data)
(-> Binary (Try (Hash <kind>)))
(if (n.= <size> (binary.size data))
{try.#Success (abstraction data)}
@@ -109,15 +109,15 @@
[as_md5 MD5 ..md5::size ..not_a_md5]
)
- (def: hash_size
+ (def hash_size
(-> Text Nat)
(|>> text.size (n./ ..hex_per_byte)))
- (def: encoding_size
+ (def encoding_size
(-> Nat Nat)
(n.* ..hex_per_byte))
- (def: (decoded size constructor encoded)
+ (def (decoded size constructor encoded)
(All (_ h)
(-> Nat (-> Binary (Try (Hash h)))
(-> Text (Try (Hash h)))))
@@ -150,20 +150,20 @@
(exception.except ..not_a_hash [(..encoding_size size) encoded]))))
(with_template [<codec> <hash> <nat> <constructor>]
- [(def: .public <codec>
+ [(def .public <codec>
(Codec Text (Hash <hash>))
(implementation
- (def: encoded (|>> representation ..encoded))
- (def: decoded (..decoded <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]
)
- (def: .public equivalence
+ (def .public equivalence
(All (_ h) (Equivalence (Hash h)))
(implementation
- (def: (= reference subject)
+ (def (= reference subject)
(at binary.equivalence =
(representation reference)
(representation subject)))))