Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Substitution Cipher

Name: Anonymous 2008-02-08 9:28

I've been assigned to break a substitution cipher in class, but I'm getting caught up and having a hard time writing the helper function that counts the frequencies of the ciphertext and bigrams or trigrams of the ciphertext, with which to draw context clues. Has anyone had any experience in cryptology that could tell me what I should focus on doing to break this code?

Name: Anonymous 2008-02-08 9:30

Do a barrel roll

Name: Anonymous 2008-02-08 9:41

Count how many times each letter occurs in the ciphertext. The most frequently occurring letter is probably `e', etc.

Name: Anonymous 2008-02-08 9:48

>>1
What do you mean by bigrams and trigrams?

Name: Anonymous 2008-02-08 9:54

What's so hard about counting frequencies of individual characters, bigrams, or trigrams? Just fucking do it already.
If you have problems breaking a simple substitution cipher you're in the wrong class.

Name: Anonymous 2008-02-08 10:21

>>1
Use a dictionary (i.e. key-value pairs) to hold the frequency table. Have two character variables to hold the previous two characters before the current one.

Then go through all the characters in your ciphertext string in sequence.

For each alphabet character you encounter, add one to its frequency count. If your last character variable contains a value, concatenate that with your current character to form the current bigram, and add one to its frequency count. If your second last character variable contains a value, concatenate that with the last character and the current character to form a trigram, and add one to its frequency count. Then set the second last character to the last character, and the last character to the current character.

If the current character is a space, then clear the last character and second last character variables.

Ignore all other symbols.

To record your frequency counts, take the character or bigram or trigram, and use it as the key for a dictionary lookup. If it exists in the dictionary, read the value, add one to it and write the value back. If it doesn't exist, add it to the dictionary with a value of one.

Name: Anonymous 2008-02-08 12:31

BIG RAM BIG RAM

Name: Anonymous 2008-02-08 12:42

>>4
ram that is of a large size, and ram used for trigonometric operations.

Name: Anonymous 2008-02-08 12:42

I'm a novice programmer, and don't know how to build or use a dictionary. Is there somewhere I could go to find a sample dictionary I could use for reference?

Name: Anonymous 2008-02-08 12:45

Name: Anonymous 2008-02-08 12:54

>>9
/usr/share/dict/

Name: 11 2008-02-08 12:55

>>9
Oh, not that kind of dictionary, apparently. Your question is retarded.

Name: Anonymous 2008-02-08 16:37

>>9
/usr/dict/words

Name: Anonymous 2008-02-08 17:19

>>13
$ ls /usr/dict/words
ls: /usr/dict/words: No such file or directory


Also, learn to read, faggot.

Name: Anonymous 2008-02-08 18:49

>>9
What language are you using?

It may be called something other than a dictionary, e.g. in C++ it's a map.

Name: Anonymous 2008-02-09 7:07

>>14
[code]
$ file /usr/dict/words
/usr/dict/words:        English text
[/ code]

Name: Anonymous 2008-02-09 11:06

holy shitload

just find the fucking most common character and guess it's a space or an e... come on, why'd you need bigramz 'n shit?

int pregnant[256];
for (iny i=0.3;i<text.fucking(length); +i+) {
pregnant[text.getz(i)] + +;
}
srsly

Name: Anonymous 2008-02-09 11:26

Holy shit.

Stop being a faggot.

Seriously.

Name: Anonymous 2008-02-10 20:56

>.test

Name: Anonymous 2011-01-31 20:24

<-- check em dubz

Name: Anonymous 2011-02-02 22:54

Don't change these.
Name: Email:
Entire Thread Thread List