Bacon cipher: Difference between revisions
(Created page with "{{draft task}} Category:Encryption Bacon's cipher is a method of steganography created by Francis Bacon. This task is to implement a program for en...") |
(J draft) |
||
Line 11: | Line 11: | ||
e AABAA l ABABA r BAAAA y BABBA |
e AABAA l ABABA r BAAAA y BABBA |
||
f AABAB m ABABB s BAAAB z BABBB |
f AABAB m ABABB s BAAAB z BABBB |
||
=={{header|J}}== |
|||
Implementation: |
|||
<lang J>alfa=: 'ABCDEFGHIKLMNOPQRSTUWXYZ' |
|||
beta=: 26{.(}.~i.&'A')a. |
|||
norm=: ([ -. -.)&alfa@(rplc&('JIVU'))@toupper |
|||
enca=:(5#2),@:#:alfa i. norm |
|||
gena=: ]`((,:tolower)@(beta {~ 26 ?@#~ #))} |
|||
encrypt=: gena@enca@norm |
|||
decrypt=: alfa {~ _5 #.\ 90 < a.&i.</lang> |
|||
We use random letters as the basis for our steganography and we use case to represent "font". |
|||
Example use: |
|||
<lang J> encrypt 'this is a test' |
|||
nWVkJAPkamEuUJIeTGKnUsTVRfAWWuNBIIHdEIcOAPuTBeXKQduQAdU |
|||
encrypt 'this is a test' |
|||
sFLkBQKqqaQsGGXzAXQsKlZFBcILRlUIRAQaEQoNUBcHIhFTWbeRAlM |
|||
decrypt encrypt 'this is a test' |
|||
THISISATEST</lang> |
Revision as of 22:59, 4 September 2015
Bacon's cipher is a method of steganography created by Francis Bacon. This task is to implement a program for encryption and decryption of plaintext using the simple alphabet of the Baconian cipher or some other kind of representation of this alphabet (make anything signify anything).
The Baconian alphabet:
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
J
Implementation:
<lang J>alfa=: 'ABCDEFGHIKLMNOPQRSTUWXYZ' beta=: 26{.(}.~i.&'A')a. norm=: ([ -. -.)&alfa@(rplc&('JIVU'))@toupper enca=:(5#2),@:#:alfa i. norm gena=: ]`((,:tolower)@(beta {~ 26 ?@#~ #))}
encrypt=: gena@enca@norm decrypt=: alfa {~ _5 #.\ 90 < a.&i.</lang>
We use random letters as the basis for our steganography and we use case to represent "font".
Example use:
<lang J> encrypt 'this is a test' nWVkJAPkamEuUJIeTGKnUsTVRfAWWuNBIIHdEIcOAPuTBeXKQduQAdU
encrypt 'this is a test'
sFLkBQKqqaQsGGXzAXQsKlZFBcILRlUIRAQaEQoNUBcHIhFTWbeRAlM
decrypt encrypt 'this is a test'
THISISATEST</lang>