A C implementation of the Baconian Cipher ! BACON
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
deps/ok
include
man
src
.gitignore
LICENSE
Makefile
README.md
package.json
test.c

README.md

libbacon

A C implementation of the Baconian Cipher ! BACON

about

Inspired by bacon-cipher !

Encode or decodes a message with each letter of the plaintext replaced by a group of five of the letters consisting of either an A or B. This replacement is a binary encoding and is done according to the alphabet of the Baconian cipher.

The default translation table is shown below:

a   AAAAA   g     AABBA   n    ABBAA   t     BAABA
b   AAAAB   h     AABBB   o    ABBAB   u-v   BAABB
c   AAABA   i-j   ABAAA   p    ABBBA   w     BABAA
d   AAABB   k     ABAAB   q    ABBBB   x     BABAB
e   AABAA   l     ABABA   r    BAAAA   y     BABBA
f   AABAB   m     ABABB   s    BAAAB   z     BABBB

install

clib:

$ clib install jwerle/libbacon

source:

$ git clone git@github.com:jwerle/libbacon.git
$ cd libbacon
$ make
$ make install

usage

Command line utility:

encode:

$ echo abc | bacon --encode
AAAAAAAAABAAABA
$ { echo abc && echo def && echo ghi; }  | bacon --encode
AAAAAAAAABAAABA
AAABBAABAAAABAB
AABBAAABBBABAAA

decode:

$ echo AAAAAAAAABAAABA | bacon --decode
ABC
$ { echo 'AAAAAAAAABAAABA' && echo 'AAABBAABAAAABAB' && echo 'AABBAAABBBABAAA'; } | bacon --decode
ABC
DEF
GHI

C Library:

encode:

#include <bacon.h>
#include <stdio.h>

int
main (void) {
  printf("%s\n", bacon_encode("foo bar", NULL));
  return 0;
}

...yields:

AABABABBABABBAB AAAABAAAAABAAAA

decode:

#include <bacon.h>
#include <stdio.h>

int
main (void) {
  char *buf = "AA AA AA AAA BAAAB AAAABBA ABAAA.ABAB#AABBA@AABB+BABAA/AABAAAABAABABABAA"
    "B_ABBABBAAABBABABBB AABBBBBAAAABAAABBAABABAAB<BBAABBBABAABABABBA>BBABABB"
    "B";

  printf("%s\n", bacon_decode(buf, NULL));
  return 0;
}

...yields:

A B CD E F G H IIKL MNO PQRST UUWX YZ

api

See bacon.h

license

MIT