Skip to content

Commit 0a1e5e3

Browse files
committed
update readme
1 parent 768f8c8 commit 0a1e5e3

File tree

2 files changed

+67
-9
lines changed

2 files changed

+67
-9
lines changed

README.adoc

Lines changed: 64 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
= zlib-tiny
22

3-
A Clojure library designed to cover basic need of packing|unpacking exchange messages, storable chunks etc.
4-
Not more, but not less
3+
A Clojure library designed to cover basic needs of packing|unpacking exchange messages, storable chunks etc.
4+
And to check their consistency.
55

66
image:https://img.shields.io/clojars/v/net.tbt-post/zlib-tiny.svg[]
77

@@ -11,10 +11,14 @@ Add the following to your http://github.com/technomancy/leiningen[Leiningen's] `
1111

1212
[source,clojure]
1313
----
14-
[net.tbt-post/zlib-tiny "0.2.5"]
14+
[net.tbt-post/zlib-tiny "0.3.0"]
1515
----
1616

17-
[source, clojure]
17+
=== Compress
18+
19+
==== ZLib
20+
21+
[source,clojure]
1822
----
1923
;; ZLib Example
2024
@@ -32,7 +36,9 @@ Add the following to your http://github.com/technomancy/leiningen[Leiningen's] `
3236
bytes->str)
3337
----
3438

35-
[source, clojure]
39+
==== GZip
40+
41+
[source,clojure]
3642
----
3743
;; GZip Example
3844
@@ -48,13 +54,65 @@ Add the following to your http://github.com/technomancy/leiningen[Leiningen's] `
4854
bytes->str)
4955
----
5056

51-
[source, clojure]
57+
=== Checksums
58+
59+
==== CRC
60+
61+
[source,clojure]
5262
----
5363
;; CRC32 example
5464
(crc32 (.getBytes "123456789"))
5565
=> 3421780262
5666
----
5767

68+
[source,clojure]
69+
----
70+
;; CRC64 example
71+
(crc64 (.getBytes "123456789"))
72+
=> -7395533204333446662
73+
----
74+
75+
==== Digests
76+
77+
[source,shell]
78+
----
79+
$ echo -n 'test it!' | md5
80+
f4214812f0247f69661fd29e0fca6496
81+
82+
$ echo -n 'test it!' | shasum -a 1
83+
1393ce5dfcf39109a420eb583ecfdeacc28c783a -
84+
85+
$ echo -n 'test it!' | shasum -a 256
86+
9c507d01834b2749d088122a7b3d200957f9b25579b5ce6b490e3b2067ee4f66 -
87+
----
88+
89+
[source,clojure]
90+
----
91+
(import '(org.apache.commons.codec.binary Hex))
92+
(-> "test it!" str->bytes md5 Hex/encodeHex String.)
93+
=> "f4214812f0247f69661fd29e0fca6496"
94+
(-> "test it!" str->bytes sha-1 Hex/encodeHex String.)
95+
=> "1393ce5dfcf39109a420eb583ecfdeacc28c783a"
96+
(-> "test it!" str->bytes sha-256 Hex/encodeHex String.)
97+
=> "9c507d01834b2749d088122a7b3d200957f9b25579b5ce6b490e3b2067ee4f66"
98+
----
99+
100+
== Test
101+
102+
[source,text]
103+
----
104+
$ lein test
105+
106+
...
107+
108+
lein test zlib-tiny.checksum
109+
110+
lein test zlib-tiny.compress
111+
112+
Ran 3 tests containing 7 assertions.
113+
0 failures, 0 errors.
114+
----
115+
58116
== Manual Build
59117

60118
[source,text]

test/zlib_tiny/checksum.clj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,18 @@
1717
str->bytes
1818
md5
1919
Hex/encodeHex
20-
(String.)))))
20+
String.))))
2121
(testing "SHA1"
2222
(is (= "1393ce5dfcf39109a420eb583ecfdeacc28c783a"
2323
(-> test-string
2424
str->bytes
2525
sha-1
2626
Hex/encodeHex
27-
(String.)))))
27+
String.))))
2828
(testing "SHA256"
2929
(is (= "9c507d01834b2749d088122a7b3d200957f9b25579b5ce6b490e3b2067ee4f66"
3030
(-> test-string
3131
str->bytes
3232
sha-256
3333
Hex/encodeHex
34-
(String.))))))
34+
String.)))))

0 commit comments

Comments
 (0)