[net.tbt-post/zlib-tiny "0.4.0"]
A Clojure library designed to cover basic needs of packing|unpacking exchange messages, storable chunks etc. And to check their consistency.
Add the following to your Leiningen’s project.clj
:
[net.tbt-post/zlib-tiny "0.4.0"]
From version v0.3.2 and upward the library requires Java class versions 53.0 and newer (J11+), thus if in your needs is to use it with Java 1.8 please switch back to older (0.2.x) version of the library or try to rebuild the library locally. |
;; ZLib Example
(bytes->str
(force-byte-array
(inflate
(deflate
(str->bytes "test it!")))))
(-> "test it!"
str->bytes
deflate
inflate
force-byte-array
bytes->str)
;; GZip Example
(bytes->str
(gunzip
(gzip
(str->bytes "test it!"))))
(-> "test it!"
str->bytes
gzip
gunzip
bytes->str)
;; CRC32 example
(crc32 (.getBytes "123456789"))
=> 3421780262
;; CRC64 example
(crc64 (.getBytes "123456789"))
=> -7395533204333446662
$ echo -n 'test it!' | md5
f4214812f0247f69661fd29e0fca6496
$ echo -n 'test it!' | shasum -a 1
1393ce5dfcf39109a420eb583ecfdeacc28c783a -
$ echo -n 'test it!' | shasum -a 256
9c507d01834b2749d088122a7b3d200957f9b25579b5ce6b490e3b2067ee4f66 -
(-> "test it!" str->bytes md5 hexlify)
=> "f4214812f0247f69661fd29e0fca6496"
(-> "test it!" str->bytes sha-1 hexlify)
=> "1393ce5dfcf39109a420eb583ecfdeacc28c783a"
(-> "test it!" str->bytes sha-256 hexlify)
=> "9c507d01834b2749d088122a7b3d200957f9b25579b5ce6b490e3b2067ee4f66"
(-> "test it!" str->bytes sha-512 hexlify)
=> "15353093ef47d2eadefc55d7bc641b6f1150e0b28a609d2368394748091f20b9125e98fe0603b2fbe57f9d65a9b286a8d0dbf70e8f597525051b6f9220e9b61f"
$ lein test
...
lein test zlib-tiny.checksum
lein test zlib-tiny.compress
Ran 3 tests containing 8 assertions.
0 failures, 0 errors.
$ lein install
Copyright © 2017-2021
Distributed under the Apache License v 2.0
Can you improve this documentation? These fine people already did:
MelKori & source-cEdit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close