| Welcome to Crypto. We hope you enjoy your visit. You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free. Join our community! If you're already a member please log in to your account to access all of our features: |
| Linear Congruential Prng | |
|---|---|
| Topic Started: Feb 4 2007, 05:03 PM (284 Views) | |
| jdege | Feb 4 2007, 05:03 PM Post #1 |
|
Elite member
![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
I'm still working through the problems from Cryptanalysts' Corner. The second problem is:
This is encoded with a linear congruential pseudo-random number generator. The plaintext is converted to integers, each letter becoming a pair of digits: A:01, B:02, Z:26. This is added, digit-by-digit, to a keystream, mod-9. The keystream is a sequence of four-digit integers, generated using the PRNG. k(n+1) = k(n) * A + B (mod C) A, B, C, and the seed k(0) compose the key. The crib is "BRIANWINKEL", with the 'W' represented by the 22nd, 23rd, or 24th pair of digits. |
| When cryptography is outlawed, bayl bhgynjf jvyy unir cevinpl. | |
![]() |
|
| insecure | Feb 4 2007, 10:11 PM Post #2 |
|
Elite member
![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
If it's modulo 9, how come there are several 9s in the ciphertext? Do you mean mod 10? |
![]() |
|
| jdege | Feb 4 2007, 10:54 PM Post #3 |
|
Elite member
![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Yes, I did mean modulo 10. There was an article on how to break this sort of cipher in the first issue of Cryptologia: ``Cracking" a Random Number Generator by James Reeds. Volume I, Number 1, January 1977.20-26 |
| When cryptography is outlawed, bayl bhgynjf jvyy unir cevinpl. | |
![]() |
|
| insecure | Feb 4 2007, 11:43 PM Post #4 |
|
Elite member
![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
If we're going to crack it, it's much simpler if we know exactly how it was enciphered, and a computer program is a great way to describe a process exactly. So - if I'm understanding you correctly, encryption goes like this:
I particularly draw your attention to the fact that, according to the interpretation above, k is used unmodified to encrypt the first digit of the first (translated-to-01-to-26) character, and then k is modified by the PRNG. Is that basically right? |
![]() |
|
| jdege | Feb 5 2007, 04:56 AM Post #5 |
|
Elite member
![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
When I start messing about with a new encryption system, I like to write a program that will handle the encryption and decryption, just so I can test my understanding of how it works. Railfence, for example, seemed like a very simple thing. But laying out the positions for decryption turned out to be more complicated than I would have expected, before I started trying to code it. As for your code, you don't quite have it. Each element of the key stream is an integer in [0,10,000). That is, each integer is four digits. And those four digits are used to encrypt four digits (two characters) of the plaintext. Then the PRNG is run through another cycle to create the next four digits. It follows pretty clearly, then, that the modulus C must be less than 10,000. |
| When cryptography is outlawed, bayl bhgynjf jvyy unir cevinpl. | |
![]() |
|
| loki | Feb 5 2007, 12:30 PM Post #6 |
|
Advanced Member
![]() ![]() ![]() ![]() ![]()
|
My first go at railfence, I attempted it by using this method. I had two arrays A and B, read first put it in A and next char goes into B, I padded with an 'X'. It worked preety good for me. |
| c(x) = 3x3 + x2 + x + 2; Find the inverse | |
![]() |
|
| jdege | Feb 5 2007, 01:26 PM Post #7 |
|
Elite member
![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
That works fine for a two-rail fence. But for a five-rail fence it's a little tricky working out just how many characters go in each row.
[/font] Particularly if you: 1. don't pad to a complete V at the end, 2. allow an offset from the start of a V at the beginning (e.g. 1st character is placed in the third rail, where the 'C' is above). 3. read the rails off in keyword order. |
| When cryptography is outlawed, bayl bhgynjf jvyy unir cevinpl. | |
![]() |
|
| 1 user reading this topic (1 Guest and 0 Anonymous) | |
| « Previous Topic · Challenges · Next Topic » |





![]](http://209.85.122.85/static/1/pip_r.png)



5:26 PM Nov 25