Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Encrypted Message Help

  1. Sep 24, 2010 #1
    Hey folks,

    I have a bit of a brain teaser I'm stumped on at the moment. I have an encrypted message I could use some help decrypting. The encryption algorithm is as follows: Read the plain text into 16 character blocks. Each such block will be converted to a BigInteger by treating it as a 16 digit number in a base 128 number system. (The ASCII code of a character is 7 bits.) Incomplete blocks should be padded up by blanks at the end. This will produce a sequence of
    BigIntegers representing the block-by-block encoding of the plain text input. Then those BigIntegers will be encrypted by multiplying each by a BigInteger (the Key) that is supposed to be secret.

    This is very straight forward and easy to implement, but decrypting a secret message without the key is my current goal. If you are up for the challenge give this a shot and keep me posted on the results.


    Again, this would be divided by the secret key, and then the plain text could be derived by modding and dividing by 128 and converting into ascii.
  2. jcsd
  3. Sep 25, 2010 #2
    Hmmm... I don't quite get it--

    So the first "16 character block" is "3722413721597234"?

    Treat the 16 digit number above as a base 128 number? If so:

    4 => 4
    34 => 388
    234 => 33156
    7234 => 14713220
    97234 => 283148676

    The number in question would require (I think) 14 bytes to represent it, but a Big Integer is typically only 8 bytes?

    What is a "blank"? You mean that the remaining bits should be 0-filled to complete a "Big Integer"? Assuming that this is supposed to be a 16-byte integer, would that mean filling the remaining 16 bits with 0's?

    ASCII encoding? I missed something, because if the last 2 bytes are always 0-filled, that's not an ASCII character.

    I think I missed something in there somewhere. :confused:

  4. Sep 27, 2010 #3
    I'll clarify with an example. hello would be converted to 28130883183 before encryption.

    So, to decrypt this decoded integer string I would simply do 28130883183 mod 128 = 111 (111 = the ascii character o). o is the last character in the character string hello. To get the remaining characters, I would dive 28130883183 by 128 and mod again by 128.

    Ex. 28130883183 /128 = 219772525

    219772525 % 128 = 109 ( the letter l in ascii)

    Hope that helps you understand. Sorry I wan't more clear the first post.
  5. Sep 27, 2010 #4
    Ok, so to convert from the string to the number, you're taking the ASCII value of each character, removing the 1st bit (which is necessarily 0 in normal ASCII), and then concatenating each of the 7-bits together to form a resultingly huge number, which is then interpreted into a resulting number.

    h => 104 => 1101000
    e => 101 => 1100101
    l => 108 => 1101100
    l => 108 => 1101100
    o => 111 => 1101111

    Results in: 11010001100101110110011011001101111
    Which translates to: 28130883183

    So, OK, I get that part. Now, there's something else about an encryption key-- I assume you mean to suggest that this number (28130883183) is multiplied by the encryption key, producing a different number, which is the one (or ones?) you posted earlier? Does that mean that each one of the 9 numbers you posted is a separate number? Or is it all one big number? Is the scope of the key known? That is, is it an integer? A fraction? An irrational number? Is it within a certain range?

    Finally, where do the "blanks" come in?

Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook