[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.lisp

encoding and decoding randomly

snrh4x0r

11/7/2015 5:53:00 AM

There is a file which includes words from beginning of 26 letter english alphabet to end about 16000 or more Like *words.lisp* of content,

[code] (defparameter *words* '(
(a b a c a)
(a b a c a s)
(a b a c k)
.
.
.
.
(z y m o t i c)
(z y m u r g y))
[/code]
As I said the alphabet file also there is. Like, *alph.lisp* of content

[code]`(defparameter *alphabet* '(a b c d e f g h i j k l m n o p q r s t u v w x y z))`
[/code]

I have been trying to write a function that finds the encoder of a given encrypted paragraph using the words file. As you can see, words are represented as atom lists and paragraphs are represented as list of lists (word lists). Alphabet is defined as atom list. Encrypted paragraph will be the argument of the function and as known the words and alphabet.[b] Encoder is a one-to-one, randomly shuffled alphabet[/b]




[code] Original Paragraph:
((A N X I O U S) ( H O M E ) ( N O I S E ))
Encrypted Paragraph:
((G P N Y A X Q) ( J A B L ) ( P A Y Q L ))

Alphabet: (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z)

I try to find the encrypter

Encrypter : (G Z O C L H T J Y M E R B P A F W K Q I X U S N V D)
[/code]
I want advices what should I do? How can I start?

[code] Example input
(find-encrypter '((G P N Y A X Q) ( J A B L ) ( P A Y Q L )))
Example output:
(G Z O C L H T J Y M E R B P A F W K Q I X U S N V D)
[/code]
I have just written three to be an example but actually around 15 encoded words will be entered as input
Could you guide?
1 Answer

Pascal J. Bourguignon

11/7/2015 6:36:00 AM

0

snrh4x0r@gmail.com writes:

> There is a file which includes words from beginning of 26 letter english alphabet to end about 16000 or more Like *words.lisp* of content,
>
> [code] (defparameter *words* '(
> (a b a c a)
> (a b a c a s)
> (a b a c k)
> .
> .
> .
> .
> (z y m o t i c)
> (z y m u r g y))
> [/code]
> As I said the alphabet file also there is. Like, *alph.lisp* of content
>
> [code]`(defparameter *alphabet* '(a b c d e f g h i j k l m n o p q r s t u v w x y z))`
> [/code]
>
> I have been trying to write a function that finds the encoder of a
> given encrypted paragraph using the words file. As you can see, words
> are represented as atom lists and paragraphs are represented as list
> of lists (word lists). Alphabet is defined as atom list. Encrypted
> paragraph will be the argument of the function and as known the words
> and alphabet.[b] Encoder is a one-to-one, randomly shuffled
> alphabet[/b]
>
>
>
>
> [code] Original Paragraph:
> ((A N X I O U S) ( H O M E ) ( N O I S E ))
> Encrypted Paragraph:
> ((G P N Y A X Q) ( J A B L ) ( P A Y Q L ))
>
> Alphabet: (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z)
>
> I try to find the encrypter
>
> Encrypter : (G Z O C L H T J Y M E R B P A F W K Q I X U S N V D)
> [/code]
> I want advices what should I do? How can I start?
>
> [code] Example input
> (find-encrypter '((G P N Y A X Q) ( J A B L ) ( P A Y Q L )))
> Example output:
> (G Z O C L H T J Y M E R B P A F W K Q I X U S N V D)
> [/code]

> I have just written three to be an example but actually around 15
> encoded words will be entered as input Could you guide?

Since the encryption is a simple permutation, it doesn't change a lot of
properties of the clear text. Notably:

- the length of the words.
- the frequencies of the letters.
- the frequencies of bigrams and trigrams.

If you have examples of cleartexts, you could compute the frequency of
each letter from it.

Without examples, you could compute the frequencies from the dictionary,
but it would be distorted (some words are more frequent than others).
So assuming that you have a small number of words in your message, you
could instead select in the dictionary the words of length found in the
message, and compute the frequency of letters only in those. Then
matching the clear and encrypted letters in the order of frequency, you
could make hypotheses about their correspondance. Usually this works well
for the most frequent letters in the message.

But in your example, there are only 10 letters, so in this case you
won't be able to recover the whole permutation, only a familly of
permutations (any permutation of the remaining letters would give the
same encryption on such a short message).

--
__Pascal Bourguignon__ http://www.informat...
â??The factory of the future will have only two employees, a man and a
dog. The man will be there to feed the dog. The dog will be there to
keep the man from touching the equipment.� -- Carl Bass CEO Autodesk