diff options
author | Matthias Andreas Benkard <code@mail.matthias.benkard.de> | 2011-08-18 01:21:19 +0200 |
---|---|---|
committer | Matthias Andreas Benkard <code@mail.matthias.benkard.de> | 2011-08-18 01:21:19 +0200 |
commit | 1eea2ecacef4398d0806042ded266ead9db39de8 (patch) | |
tree | ed5d5a1e46c4ad0b6521020f6d6c3ef903429231 /util.rkt | |
parent | a040de5c1f8c505e497149b901ed5ccf42288a53 (diff) |
Implement Threefish.
Diffstat (limited to 'util.rkt')
-rw-r--r-- | util.rkt | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -20,6 +20,7 @@ (provide integer->bytes integer->bytes/size bytes->integer + bytes->integer/le pad-bytes Justification Endianness @@ -58,6 +59,13 @@ (bitwise-ior (arithmetic-shift n 8) byte))) +(define: (bytes->integer/le [b : Bytes]) : Exact-Nonnegative-Integer + (for/fold: ([n : Exact-Nonnegative-Integer 0]) + ([byte : Byte (in-bytes b)] + [i : Integer (in-naturals)]) + (bitwise-ior (arithmetic-shift byte (* i 8)) + n))) + (define: (pad-bytes [b : Bytes] [s : Exact-Nonnegative-Integer] [fill : Byte] |