🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.privacy.anon-server
Article #306668

Re: Help needed for a binary to words Encoder / Decoder (wordlist)

#306668
From: Rich
Date: Tue, 22 Oct 2019 20:24
24 lines
1813 bytes
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]]);
Technical Details
Message-ID: <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
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>

Show Full Headers
Complete Article Headers
Message-ID: <qonoh5$q2r$1@dont-email.me>
Subject: Re: Help needed for a binary to words Encoder / Decoder (wordlist)
Date: Tue, 22 Oct 2019 20:24:05 +0000
From: Rich <rich@example.invalid>
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>
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: 25
Sender: <rellis@d820.dp100.com>
Injection-Date: Tue, 22 Oct 2019 20:24:05 -0000 (UTC)
User-Agent: tin/2.0.1-20111224 ("Achenvoir") (UNIX) (Linux/3.10.17 (x86_64))
Cancel-Lock: sha1:ufbfkdkLPQphFcMGWKeehhQyCEI=