Article View: alt.privacy.anon-server
Article #306670Re: Help needed for a binary to words Encoder / Decoder (wordlist)
From: Stefan Claas
Date: Tue, 22 Oct 2019 20:38
Date: Tue, 22 Oct 2019 20:38
41 lines
2356 bytes
2356 bytes
Rich wrote:
> In sci.crypt Stefan Claas <sac@300baud.de> wrote:
> > Yes, 256 words because for every byte combination from 0-255.
> >
> > This is then of course not optimal for encoding
>
> Actually, for encoding (and in C) it can be quite optimal.
>
> You simply create a lookup table. I.e. (note, off the cuff, so excuse
> any C syntax mistakes):
>
> char * wordmap[256];
>
> wordmap is an array of 256 pointers to chars.
>
> Then, you init the array of pointers by inserting pointers to C
> strings, one per word, into each element of the array (how to read in
> and store the word strings is left as an exercise).
>
> Then encoding becomes reading data into an array of uint8_t's (uint8_t
> buffer[4096]), and using the value of each byte in the array as an
> index into the lookup table (with suitable handling of line breaks
> every so often and the like):
>
> printf("%s ", wordmap[buffer[i]]);
>
Thanks for pointing this out! Unfortunately I am no programmer
to express better what I mean. Compared to, lets say, a base64
encoder the file size is for me much larger with this encoder.
But at least it gets the job done, for small binary blobs. :-)
Regards
Stefan
--
box: 4a64758de9e8ceded2c481ee526440687fe2f3a828e3a813f87753ad30847b56
certified OpenPGP key blocks available on keybase.io/stefan_claas
Technical Details
Message-ID:
<20191022223842.0000272d@300baud.de>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!apf1.newsdeef.eu!not-for-mailReferences:
<20191022184945.00005433@300baud.de> <qonhab$1k73$1@gioia.aioe.org> <20191022203228.00005700@300baud.de> <qonim2$1qj1$1@gioia.aioe.org> <20191022205335.000064f4@300baud.de> <qonoh5$q2r$1@dont-email.me>Show Full Headers
Complete Article Headers
Message-ID: <20191022223842.0000272d@300baud.de> Subject: Re: Help needed for a binary to words Encoder / Decoder (wordlist) Date: Tue, 22 Oct 2019 22:38:42 +0200 From: Stefan Claas <sac@300baud.de> References: <20191022184945.00005433@300baud.de> <qonhab$1k73$1@gioia.aioe.org> <20191022203228.00005700@300baud.de> <qonim2$1qj1$1@gioia.aioe.org> <20191022205335.000064f4@300baud.de> <qonoh5$q2r$1@dont-email.me> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!apf1.newsdeef.eu!not-for-mail Newsgroups: sci.crypt,alt.privacy.anon-server Organization: A noiseless patient Spider Lines: 42 Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cancel-Lock: sha1:7SsoW/WKBIhQA08BH5A33OPRJuc= X-Newsreader: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-w64-mingw32)