[SOLVED] need help breaking a stream cipher given as assignment
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
need help breaking a stream cipher given as assignment
Well I am given a couple of crypted messeges and my goal is to break them and then submit the message. There are 10 messages that are encrypted using a stream cipher. And all are encrypted using the same key. Our teacher expects us to figure out the key from these 11 messeges somehow. I need advice on how to achieve this. What steps should I take to proceed and how to figure out the key?
The messages are in Hex, which in turn are Xor of the ASCII of the message characters and PRG key.
If they are encrypted with the SAME keystream then XOR of one ciphertext with another exposes text with no key but with the XOR of two plaintexts. If that is the arrangement you can get 10 of these independently.
Plaintext XOR plaintext reveals information - and for English text for instance leads to the messages being detectable.
All that is an information problem rather than a Linux problem. Have you tried a crypto forum?
Now Since they are encryped using the same key therefore Xoring would cancel out the keys and return the XOR of two original messeges
Then I Xor-ed "Space" with the alphabats and then I started looking for that in m1.XOR.m2 and I got my eyes on '4c' then I tried XOring the Third Characer on m1 and m2 with '20'(hex of Space key code in ascii) and I got two options '6e' and '22'. Now since one of these had to be the third bit of the key so I Xor-ed bot these keys with the 3rd bit in m2 and m3. Now If one of them was the key so XOR-ing the resultant should yeild the 3rd bit of m2.XOR.m3 But It didn't happened. The closest I got was '0x9' with key '22' as compared to the 3rd bit of m2.XOR.m3 '09' so I'm kinda stuck here thinking what else should I do.and I am panicking because I have to submit it by monday.
Two messages start "32 51 0b a9" and two start "32 51 0b fb ac fb b9 be fd 54 41 5d a2 43 e1 69 5e ca bd 58 c5 19 cd 4b" which if you thought was "The " and so on you'd have a start. Guessing just the next char in one message if you're right reveals the next char in all messages.
We can fac 41 45 bf 43 e1 78 4b 8f a0 0d
Euler woul 51 0a bd 11 fa 72 4f cd a2 01
The nice t 5d 43 a3 04 b5 71 4c c0 bb 0c
The cipher 41 4f b5 17 b5 60 5c c0 aa 0d
You don't 42 4b a3 17 b5 64 41 8f ac 0d
There are 41 5d a2 43 e1 69 5e ca bd 58
There are 41 5d a2 43 e1 69 5e ca bd 58
We can see 15 5e a5 06 b5 60 41 c6 a0 0c
A (private 18 41 a8 1a bc 30 0e ca a0 1b
The Conci 46 4f ed 2c ed 76 41 dd aa 3c
We can factor the number 15 w 40 b1 63 49 c1 46 fb 77 8c df 2d
Euler would probably enjoy th 48 b1 2b 07 df 44 ba 71 91 d9 60
The nice thing about Keeyloq 40 b6 2b 07 df 44 ba 6e 9d 8a 23
The ciphertext produced by a 5e a0 6a 02 90 56 f4 7a 8a d3 30
You don't want to buy a set o 4f e5 68 08 c2 13 f1 7c 81 d9 60
There are two types of crypto 4e b7 6a 19 d8 4a ba 34 d8 de 28
There are two types of cyptog 5b a4 7b 01 c9 09 ba 76 96 cf 60
We can see the point where th 4c e5 68 01 d9 43 ba 70 8b 8a 35
A (private-key) encryption s 4a ad 6e 04 d5 13 e9 6d 99 de 25
The Concise OxfordDictionary 09 ed 39 59 80 05 b3 39 9c cf af
We can factor the number 15 w 40 b1 63 49 c1 46 fb 77 8c df 2d
Euler would probably enjoy th 48 b1 2b 07 df 44 ba 71 91 d9 60
The nice thing about Keeyloq 40 b6 2b 07 df 44 ba 6e 9d 8a 23
The ciphertext produced by a 5e a0 6a 02 90 56 f4 7a 8a d3 30
You don't want to buy a set o 4f e5 68 08 c2 13 f1 7c 81 d9 60
There are two types of crypto 4e b7 6a 19 d8 4a ba 34 d8 de 28
There are two types of cyptog 5b a4 7b 01 c9 09 ba 76 96 cf 60
We can see the point where th 4c e5 68 01 d9 43 ba 70 8b 8a 35
A (private-key) encryption s 4a ad 6e 04 d5 13 e9 6d 99 de 25
The Concise OxfordDictionary 09 ed 39 59 80 05 b3 39 9c cf af
Thanks linosaurusroot! couldn't have done it without ya.
Finally solved the problem. If you hadn't given me the first couple of the bits in the key I wouldn't had done it.Any ways here is the full key . Took me more then two hours but finally!
BTW linosaurusroot! could you be kind enough to explain the process (step by step) using which you broke those ciphrs? Since I didn't had a clue what to do until you showed those bits. I 've just signed up for this online cryptography course, and I don't have much of that crypto background.
First I read the beginning of the message strings looking for common beginnings. (In a different analysis problem for monoalphabetic substitution I would have wanted to look for any repetition which could be the same word in different places. And would have done other things - a helpful book on pencil+paper crypto is http://www.amazon.com/The-Codebreake...dp/0684831309/ ). In this case I guessed the first 3 chars right away.
Then I wrote a program to read in your message strings and a keystream and display the messages: when they key byte was defined (right or wrong) XOR and display the plaintext else show the hex ciphertext. And I ran it only over the first so many chars.
Looking over the output I could guess a character a time (mostly correct); add to the keystream and rerun.
Thanks I'm looking at "The Codebreaker" right now. But I must say that a man with your skill should take that stanford university's online cryptography course. The way you decoded those ciphers is just amazing! I'm still Astounded.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.