🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

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

#306705
From: Chris M. Thomasson
Date: Fri, 25 Oct 2019 07:50
191 lines
5522 bytes
On 10/22/2019 9:49 AM, Stefan Claas wrote:
> Hi all,
> 
> I would like to ask you kind folks if you can help me out
> in compiling a list of 256 easy to listen and to write down
> English five letter words, so that I can create an English
> version of the following software, because I am no native
> English speaker and I would like to use the best words for it:
> 
> <https://keybase.pub/stefan_claas/software/binary2words-German-version/>
> 
> I asked my Golang programmer for a solution to encode small
> binary encrypted blobs, so that they can be send over phone,
> radio or as letter/fax.
> 
> The software uses five letter words for each byte combination
> and is as you can imagine therefore not so efficient like codegroup[1],
> but should perform the conversion task much faster IMHO,
> when one has to listen and write down the words.
> 
> I attach an English word list from EFF, which I already sieved
> down to 782 five letter words.
> 
> I would very much appreciate if someone can help me with this task,
> so that not only German speaking users can use the software.
> 
> [1] https://www.fourmilab.ch/codegroup/

Fwiw, here is some quick and dirty C99 code that simply maps a buffer of 
bytes to hex, along with a map of words:
_______________________________________
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>


struct ct_alphabet
{
     char const* foo;
     char const* bar;
};


void ct_bytes_to_hex(
     struct ct_alphabet const* abet,
     size_t abet_n,
     unsigned char* bytes,
     size_t bytes_n
) {
     assert(abet_n >= 16);

     for (size_t i = 0; i < bytes_n; ++i)
     {
         unsigned char c = bytes[i];

         printf(
             "%s%s ",
             abet[(c & 0xF0) >> 4].foo,
             abet[c & 0x0F].foo
         );

         if (! ((i + 1) % 5)) printf("\n");
     }
}


void ct_bytes_to_alphabet(
     struct ct_alphabet const* abet,
     size_t abet_n,
     unsigned char* bytes,
     size_t bytes_n
) {
     assert(abet_n >= 16);

     for (size_t i = 0; i < bytes_n; ++i)
     {
         unsigned char c = bytes[i];

         printf(
             "%s %s ",
             abet[(c & 0xF0) >> 4].bar,
             abet[c & 0x0F].bar
         );

         if (! ((i + 1) % 5)) printf("\n");
     }
}


int main(void)
{
     {
         // setup an alphabet, hardcoded to 16
         struct ct_alphabet abet[] = {
             { "0", "Hello" },
             { "1", "There" },
             { "2", "My" },
             { "3", "Name" },
             { "4", "Is" },
             { "5", "Chris" },
             { "6", "How" },
             { "7", "Are" },
             { "8", "You" },
             { "9", "Doing" },
             { "A", "Today" },
             { "B", "I" },
             { "C", "Feel" },
             { "D", "Great" },
             { "E", "Cool" },
             { "F", "Indeed" }
         };

         size_t n = sizeof(abet) / sizeof(abet[0]);

         printf("n = %lu\n\n", n);

         for (size_t i = 0; i < n; ++i)
         {
             printf("abet[%lu] = (%s, %s)\n", i, abet[i].foo, abet[i].bar);
         }

         printf("\n");

         char buf[] = "123HelloWorld456!";

         printf("convert: %s\n\n", buf);

         ct_bytes_to_hex(abet, n, buf, sizeof(buf) - 1);

         printf("\n\n");

         ct_bytes_to_alphabet(abet, n, buf, sizeof(buf) - 1);
     }


     printf("\n\nfin...\n");

     return 0;
}
_______________________________________



Fwiw, here is the output I get:
_______________________________________
n = 16

abet[0] = (0, Hello)
abet[1] = (1, There)
abet[2] = (2, My)
abet[3] = (3, Name)
abet[4] = (4, Is)
abet[5] = (5, Chris)
abet[6] = (6, How)
abet[7] = (7, Are)
abet[8] = (8, You)
abet[9] = (9, Doing)
abet[10] = (A, Today)
abet[11] = (B, I)
abet[12] = (C, Feel)
abet[13] = (D, Great)
abet[14] = (E, Cool)
abet[15] = (F, Indeed)

convert: 123HelloWorld456!

31 32 33 48 65
6C 6C 6F 57 6F
72 6C 64 34 35
36 21

Name There Name My Name Name Is You How Chris
How Feel How Feel How Indeed Chris Are How Indeed
Are My How Feel How Is Name Is Name Chris
Name How My There

fin...
_______________________________________


The spoken phrase:


Name There Name My Name Name Is You How Chris
How Feel How Feel How Indeed Chris Are How Indeed
Are My How Feel How Is Name Is Name Chris
Name How My There

actually means: 123HelloWorld456!

;^)
Technical Details
Message-ID: <qou9gl$5u2$1@gioia.aioe.org>
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>

Show Full Headers
Complete Article Headers
Message-ID: <qou9gl$5u2$1@gioia.aioe.org>
Subject: Re: Help needed for a binary to words Encoder / Decoder (wordlist)
Date: Fri, 25 Oct 2019 00:50:43 -0700
From: "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>
References: <20191022184945.00005433@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: Aioe.org NNTP Server
Lines: 191
Nntp-Posting-Host: p6bQ6fZyIxicmI5NB/uhuA.user.gioia.aioe.org
Mime-Version: 1.0
Content-Type: text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding: 7bit
X-Complaints-To: abuse@aioe.org
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0
Content-Language: en-US
X-Notice: Filtered by postfilter v. 0.9.2