]> Cypherpunks.ru repositories - netstring.git/commitdiff
cmd/netstring example
authorSergey Matveev <stargrave@stargrave.org>
Mon, 13 Jan 2020 19:12:03 +0000 (22:12 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Mon, 13 Jan 2020 19:12:03 +0000 (22:12 +0300)
README

diff --git a/README b/README
index f3630800a93b06ba8da952edd0575ef7bf3259ce..f6062e640aa33ddaae006d8563ba66178aab30c7 100644 (file)
--- a/README
+++ b/README
@@ -1,2 +1,35 @@
-netstring format serialization library.
-http://cr.yp.to/proto/netstrings.txt
+netstring format (serialization library in pure Go.
+
+Netstring is very simple binary strings serialization format. For
+example "hello world!" will be encoded as "12:hello world!,". And an
+empty string is encoded as "0:,".
+Read more at: http://cr.yp.to/proto/netstrings.txt
+
+That library contains an example utility to deal with concatenated
+netstring in single file:
+
+    $ go get go.cypherpunks.ru/netstring/cmd/netstring
+    $ ls in[123]
+    -rw------- 3490 in1
+    -rw------- 1363 in2
+    -rw------- 2003 in3
+    $ netstring write in1 in2 in3 > out
+    0       3490    in1
+    1       1363    in2
+    2       2003    in3
+    $ netstring list out
+    0       3490
+    1       1363
+    2       2003
+    $ sha256 in[123]
+    SHA256 (in1) = 3197893dc2c58d9e8853e253e68a123ad0400f0c3670ae46ce5a8ff1dfe2149f
+    SHA256 (in2) = 293d09cbd7f2e5237627440b88d2e1238818521b208922aa54079d2c13974891
+    SHA256 (in3) = 65333ba0c9f974ff7f46114a18d8f4f176734cf21a704b4a318c6416d41da0ea
+    $ netstring read out 0 | sha256
+    3197893dc2c58d9e8853e253e68a123ad0400f0c3670ae46ce5a8ff1dfe2149f
+    $ netstring read out 1 | sha256
+    293d09cbd7f2e5237627440b88d2e1238818521b208922aa54079d2c13974891
+    $ netstring read out 2 | sha256
+    65333ba0c9f974ff7f46114a18d8f4f176734cf21a704b4a318c6416d41da0ea
+
+netstring is free software: see the file COPYING for copying conditions.