| 1 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
| 2 |
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| 3 |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
| 4 |
<head> |
| 5 |
<title>CODEGROUP: Five-Letter Codegroup Filter</title> |
| 6 |
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> |
| 7 |
<link rel="stylesheet" href="http://www.fourmilab.ch/documents/styles/standard_screen.css" type="text/css" /> |
| 8 |
<meta name="author" content="John Walker" /> |
| 9 |
<meta name="description" content="CODEGROUP: Five-Letter Codegroup Filter" /> |
| 10 |
<meta name="keywords" content="codegroup, five, letter, filter, cryptography, espionage" /> |
| 11 |
<style type="text/css"> |
| 12 |
dl.sample dt { |
| 13 |
font-weight: bold; |
| 14 |
margin-bottom: 0px; |
| 15 |
margin-top: 1ex; |
| 16 |
} |
| 17 |
|
| 18 |
dl.sample dd { |
| 19 |
font-family: monospace; |
| 20 |
font-size: smaller; |
| 21 |
margin-top: 0px; |
| 22 |
white-space: pre; |
| 23 |
} |
| 24 |
</style> |
| 25 |
</head> |
| 26 |
<body class="standard"> |
| 27 |
<center> |
| 28 |
<h1><img src="codegroup.jpg" alt="CODEGROUP" width="636" height="237" /></h1> |
| 29 |
<h2> |
| 30 |
Five-Letter Codegroup Filter |
| 31 |
</h2> |
| 32 |
</center> |
| 33 |
|
| 34 |
<hr /> |
| 35 |
|
| 36 |
<p /> |
| 37 |
|
| 38 |
<p class="j"> |
| 39 |
This page describes a program, <b>codegroup</b>, which |
| 40 |
encodes and decodes arbitrary binary data in five-letter |
| 41 |
code groups, just like spies use. |
| 42 |
|
| 43 |
</p> |
| 44 |
|
| 45 |
|
| 46 |
<h3>NAME</h3> |
| 47 |
<b>codegroup</b> – encode / decode binary file as five letter |
| 48 |
codegroups |
| 49 |
|
| 50 |
<h3>SYNOPSIS</h3> |
| 51 |
<b>codegroup</b> <b>-d</b>|<b>-e</b> [ <b>-u</b> ] [ <em>infile</em> [ <em>outfile</em> ] ] |
| 52 |
|
| 53 |
<h3>DESCRIPTION</h3> |
| 54 |
|
| 55 |
<p class="j"> |
| 56 |
For decades, spies have written their encoded messages in |
| 57 |
groups of five letters. |
| 58 |
</p> |
| 59 |
|
| 60 |
<p class="j"> |
| 61 |
<b>codegroup</b> encodes any file into this form, |
| 62 |
allowing it to be transmitted through any medium, and |
| 63 |
decodes files containing codegroups into the original input. |
| 64 |
Encoded files contain a 16-bit cyclical redundancy check |
| 65 |
(CRC) and file size to verify, when decoded, that the |
| 66 |
message is complete and correct. Files being decoded may |
| 67 |
contain other information before and after the codegroups, |
| 68 |
allowing in-the-clear annotations to be included. |
| 69 |
</p> |
| 70 |
|
| 71 |
<p class="j"> |
| 72 |
<b>codegroup</b> makes no attempt, on its own, to prevent |
| 73 |
your message from being read. Cryptographic security should |
| 74 |
be delegated to a package intended for that purpose, such as |
| 75 |
<b>pgp</b>. <b>codegroup</b> can then be applied to the |
| 76 |
encrypted binary output, transforming it into easily |
| 77 |
transmitted text. Text created by <b>codegroup</b> uses |
| 78 |
only upper case ASCII letters and spaces. Unlike files |
| 79 |
encoded with <b>uuencode</b> or <b>pgp</b>'s “ASCII armour” |
| 80 |
facility, the output of codegroup can be easily (albeit |
| 81 |
tediously) read over the telephone, broadcast by shortwave |
| 82 |
radio to agents in the field, or sent by telegram, telex, or |
| 83 |
Morse code. |
| 84 |
</p> |
| 85 |
|
| 86 |
<p class="j"> |
| 87 |
To illustrate the difference, here are the first few lines |
| 88 |
of a binary file encoded by: |
| 89 |
</p> |
| 90 |
|
| 91 |
<dl class="sample"> |
| 92 |
<dt><a href="http://www.fourmilab.ch/webtools/base64/">base64</a>:</dt> |
| 93 |
<dd>H4sICFJ9MzYAA2EudGFyAOxba3faSNKer+lf0SezO3YmgLnY2I6TyQIGgwOGBTtOYjuJEMJo |
| 94 |
DJJGF1+ys//9rarulpqLHRi/mdk9G84JIKGuqq579eNkNn745q9sNru9tcXhs5gtFPAzm83l |
| 95 |
xad88WyxmNssbhe3sps8m8ttZ/M/8K1vL9oPP0RBaPggypU1vrad+59zosj0HqAj9xF//pe8 |
| 96 |
WsaVNbTH1rfkAfoobm7ea//cZn4rtv/mNtq/kM9t/cCz31Io9foftz9nnW77oMdfcdMdWJe+ |
| 97 |
</dd> |
| 98 |
|
| 99 |
<dt>uuencode:</dt> |
| 100 |
<dd>begin 644 data.bin |
| 101 |
M'XL("&7._R VUO;V /9U+FN2XSF3G6H5OA1(?HOB<=/<7__X7TN<PJ[L& |
| 102 |
M=?-&1;I+) B8 0;P?_Z'?WY_-=7Q"T_JSZ_6)X9?&"$OU9[N'A[A%^L^6= |
| 103 |
M?^M[OOV+:9=UM9J^] MAS_ ;X0O]U];(Z?<WWE9_[/]ZMMOO[CG'^2MM |
| 104 |
M_G(+,US/LWKZE1#C^YO?D_;O#G[7][2R^+0>XJ^&PI/[?7-7U]KU=]SSWQ? |
| 105 |
</dd> |
| 106 |
|
| 107 |
<dt>pgp:</dt> |
| 108 |
<dd>-----BEGIN PGP MESSAGE----- |
| 109 |
Version: 2.6.2i |
| 110 |
|
| 111 |
hIwCCb8iTku3pBUBA/9oSDlfk/On9bwjmTnB98Eejr6agkPSi3n6hd8JkAtJd33f |
| 112 |
kzFq18Jo0xzRUWZ7Di6Jq/FXpeI1yztVDqispbcYOP0aDv4JZOSF1kRsmJ9xK9Bo |
| 113 |
Cv4a967IXPkkRsjIAkx0B39dYxCzf8kHUn4THmyV/b2qLUZ0cc+mr8hxFfFpuYSM |
| 114 |
</dd> |
| 115 |
|
| 116 |
<dt>codegroup:</dt> |
| 117 |
<dd>ZZZZZ YBPIL AIAIG FMOPP CPAAA DGNGP GPGPA ADNJN ELJKO ELIMO |
| 118 |
GEOHF KIFGP IFBCB PKCPI YJMHE PHBHP PPOBH NCOHD AKLLL AGHFP |
| 119 |
DEGEF LKELC EAIJI ABAGP AHPPO IHHPH OHPDF YNFPB ALEPO KMPKP |
| 120 |
NGCHI GFPBI CBDML PFGHL LIHPC BOOBB HOLDO FJNHP OLHLL OPNIL |
| 121 |
</dd> |
| 122 |
</dl> |
| 123 |
|
| 124 |
<p class="j"> |
| 125 |
Only <b>codegroup</b> conforms to the telegraphic convention of |
| 126 |
all upper case letters, and passes the “telephone |
| 127 |
test” of being readable without any modifiers such as |
| 128 |
“capital” and “lower-case”. Avoiding |
| 129 |
punctuation marks and lower case letters makes the output of |
| 130 |
<b>codegroup</b> much easier to transmit over a voice or |
| 131 |
traditional telegraphic link. |
| 132 |
</p> |
| 133 |
|
| 134 |
<h3>OPTIONS</h3> |
| 135 |
<dl> |
| 136 |
<dt><b>-d</b></dt> <dd>Decodes the input, previously created by |
| 137 |
<b>codegroup</b>, to recover the original input file, |
| 138 |
and verifies it to detect truncation or |
| 139 |
corruption of the contents. |
| 140 |
</dd> |
| 141 |
|
| 142 |
<dt><b>-e</b></dt> <dd>Encodes the input into codegroups. |
| 143 |
</dd> |
| 144 |
|
| 145 |
<dt><b>-u</b></dt> <dd>Print how-to-call information. |
| 146 |
</dd> |
| 147 |
</dl> |
| 148 |
|
| 149 |
<h3>APPLICATION NOTES</h3> |
| 150 |
|
| 151 |
<p class="j"> |
| 152 |
Encoding a binary file as ASCII characters inevitably |
| 153 |
increases its size. When used in conjunction with existing |
| 154 |
compression and encryption tools, the resulting growth in |
| 155 |
file size is usually acceptable. For example, a random |
| 156 |
extract of electronic mail 32768 bytes in length was chosen |
| 157 |
as a test sample. Compression with <b>gzip</b> compacted the file |
| 158 |
to 15062 bytes. It was then encrypted for transmission to a |
| 159 |
single recipient with <b>pgp</b>, which resulted in a 15233 byte |
| 160 |
file. (Even though <b>pgp</b> has its own compression, smaller |
| 161 |
files usually result from initial compression with <b>gzip</b>. In |
| 162 |
this case, <b>pgp</b> alone would have produced a file of 15420 |
| 163 |
bytes.) |
| 164 |
</p> |
| 165 |
|
| 166 |
<p class="j"> |
| 167 |
<b>codegroup</b> transforms the encrypted file into a 37296 |
| 168 |
byte text file. Thus, due to compression, the code groups |
| 169 |
for the encrypted file are only a little larger than the |
| 170 |
original cleartext. |
| 171 |
</p> |
| 172 |
|
| 173 |
<p class="j"> |
| 174 |
Restricting the character set to upper case letters and including |
| 175 |
spaces between groups results in substantially larger output |
| 176 |
files than those produced by <b>uuencode</b> and <b>pgp</b>. |
| 177 |
Files encoded with codegroup are about 2.5 times the size of the |
| 178 |
input file, while <b>uuencode</b> and <b>pgp</b> expand the file |
| 179 |
only about 35%. <b>codegroup</b> is thus preferable only for |
| 180 |
applications where its limited character set is an advantage. |
| 181 |
</p> |
| 182 |
|
| 183 |
<h3>FILES</h3> |
| 184 |
<p class="j"> |
| 185 |
If no <em>infile</em> is specified or <em>infile</em> is a single |
| 186 |
“<tt>-</tt>”, <b>codegroup</b> reads from standard |
| 187 |
input; if no <em>outfile</em> is given, or <em>outfile</em> is a |
| 188 |
single “<tt>-</tt>”, output is sent to standard |
| 189 |
output. Input and output are processed strictly serially; |
| 190 |
consequently <b>codegroup</b> may be used in pipelines. |
| 191 |
</p> |
| 192 |
|
| 193 |
<h3>BUGS</h3> |
| 194 |
|
| 195 |
<p class="j"> |
| 196 |
When a CRC error is detected, no indication is given of the |
| 197 |
location in the file where the error(s) occurred. When |
| 198 |
sending large files, you may want to break them into pieces |
| 199 |
with the <b><a href="http://www.fourmilab.ch/splits/">splits</a></b> utility so, in |
| 200 |
case of error, only the erroneous pieces need to be re-sent. |
| 201 |
</p> |
| 202 |
|
| 203 |
<p class="j"> |
| 204 |
It might be nice to embed the original file name and modes |
| 205 |
in the encoded output, but this opens the door to all kinds |
| 206 |
of system-dependent problems. You can always include this |
| 207 |
information as text before the first codegroup, or |
| 208 |
send an archive created with <b>tar</b> or <b>zip</b>. |
| 209 |
</p> |
| 210 |
|
| 211 |
<h2> |
| 212 |
<a href="codegroup.zip"><img src="http://www.fourmilab.ch/images/icons/file.png" |
| 213 |
alt="" align="middle" width="40" |
| 214 |
height="40" border="0" /></a> <a href="codegroup.zip">Download codegroup.zip</a> |
| 215 |
(Zipped archive)</h2> |
| 216 |
|
| 217 |
<p class="j"> |
| 218 |
The program is provided as <a href="codegroup.zip">codegroup.zip</a>, a |
| 219 |
<a href="http://www.info-zip.org/pub/infozip/" target="_blank">Zipped</a> archive containing an |
| 220 |
ready-to-run WIN32 command-line executable program, <code>codegrp.exe</code> |
| 221 |
(compiled using Microsoft Visual C++ 5.0), |
| 222 |
and in source code form along with a |
| 223 |
<code>Makefile</code> to build the program under Unix. |
| 224 |
</p> |
| 225 |
|
| 226 |
<h3>SEE ALSO</h3> |
| 227 |
<b><a href="http://www.fourmilab.ch/webtools/base64/">base64</a></b>(1), |
| 228 |
<b>gzip</b>(1), <b>pgp</b>(1), |
| 229 |
<b><a href="http://www.fourmilab.ch/splits/">splits</a></b>(1), <b>tar</b>(1), |
| 230 |
<b>uuencode</b>(1), <b>zip</b>(1) |
| 231 |
|
| 232 |
<h3>EXIT STATUS</h3> |
| 233 |
<p class="j"> |
| 234 |
<b>codegroup</b> returns status 0 if processing was |
| 235 |
completed without errors, 1 if errors were detected in |
| 236 |
decoding a file which indicate the output is incorrect or |
| 237 |
incomplete, and 2 if processing could not be performed at |
| 238 |
all due, for example, to a nonexistent input file or no |
| 239 |
codegroups found in the input. |
| 240 |
</p> |
| 241 |
|
| 242 |
<h3>COPYING</h3> |
| 243 |
|
| 244 |
<p class="copying"> |
| 245 |
This software is in the public domain. Permission to use, copy, |
| 246 |
modify, and distribute this software and its documentation for |
| 247 |
any purpose and without fee is hereby granted, without any |
| 248 |
conditions or restrictions. This software is provided “as is” |
| 249 |
without express or implied warranty. |
| 250 |
</p> |
| 251 |
|
| 252 |
<hr /> |
| 253 |
<address> |
| 254 |
<a href="http://www.fourmilab.ch/">by John Walker</a><br /> |
| 255 |
September 7th, 2008 |
| 256 |
</address> |
| 257 |
</body> |
| 258 |
</html> |