From: Sergey Matveev Date: Mon, 13 Jan 2020 19:12:03 +0000 (+0300) Subject: cmd/netstring example X-Git-Tag: v2.1.0~1 X-Git-Url: http://www.git.cypherpunks.ru/?p=netstring.git;a=commitdiff_plain;h=1f3c210a0b7349a52995d2332c4f9b309d2aba6d cmd/netstring example --- diff --git a/README b/README index f363080..f6062e6 100644 --- 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.