Page 1 of 1

Interesting Encryptions

PostPosted: Sun Mar 28, 2010 4:02 pm
by lord_hondros
Okay, so I'm getting into encrypting data and strings. I've been thinking of ways of doing it, and here's a method I've thought of and implemented. I would like to know what you guys think of it:
a) Take key and convert to number: "This is my key" => 648;
Code: Select all
keyvalue = sum(ord(key)) / length(key)

b) Convert string to be encrypted to bin, encrypt by shifting every odd bit keyvalue to the right, then convert to hex, encrypt again, then to bin again and encrypted, then back to decimal
Code: Select all
toencrypt = 'This is to be encrypted'
keyvalue = 648
binned1 = '0101010001101000011010010111001100100000011010010111001100100000011101000110111100100000011000100110010100100000011001010110111001100011011100100111100101110000011101000110010101100100'
shifted1 = '0111010001000000011010010111100100100010011000010111100100100010011101000110010100101010011000000110011100100000011001010110010001101011011100100111001101111000011101000110010101100100'
hexed1 = '30313131303130303031303030303030303131303130303130313131313030313030313030303130303131303030303130313131313030313030313030303130303131313031303030313130303130313030313031303130303131303030303030313130303131313030313030303030303131303031303130313130303130303031313031303131303131313030313030313131303031313031313131303030303131313031303030313130303130313031313030313030'
shifted2 = '30313131303130303031303030303030303131303130303130313131313030313030313030303130303131303030303130313131313030313030313030303130303131313031303030313130303130313030313031303130303131303030303030313130303131313030313030303030303131303031303130313130303130303031313031303131303131313030313030313131303031313031313131303030303131313031303030313130303130313031313030313030'
binned2 = '0011001100110000001100110011000100110011001100010011001100110001001100110011000000110011001100010011001100110000001100110011000000110011001100000011001100110001001100110011000000110011001100000011001100110000001100110011000000110011001100000011001100110000001100110011000000110011001100010011001100110001001100110011000000110011001100010011001100110000001100110011000000110011001100010011001100110000001100110011000100110011001100010011001100110001001100110011000100110011001100000011001100110000001100110011000100110011001100000011001100110000001100110011000100110011001100000011001100110000001100110011000000110011001100010011001100110000001100110011000000110011001100010011001100110001001100110011000000110011001100000011001100110000001100110011000000110011001100010011001100110000001100110011000100110011001100010011001100110001001100110011000100110011001100000011001100110000001100110011000100110011001100000011001100110000001100110011000100110011001100000011001100110000001100110011000000110011001100010011001100110000001100110011000000110011001100010011001100110001001100110011000100110011001100000011001100110001001100110011000000110011001100000011001100110000001100110011000100110011001100010011001100110000001100110011000000110011001100010011001100110000001100110011000100110011001100000011001100110000001100110011000100110011001100000011001100110001001100110011000000110011001100010011001100110000001100110011000000110011001100010011001100110001001100110011000000110011001100000011001100110000001100110011000000110011001100000011001100110000001100110011000100110011001100010011001100110000001100110011000000110011001100010011001100110001001100110011000100110011001100000011001100110000001100110011000100110011001100000011001100110000001100110011000000110011001100000011001100110000001100110011000000110011001100010011001100110001001100110011000000110011001100000011001100110001001100110011000000110011001100010011001100110000001100110011000100110011001100010011001100110000001100110011000000110011001100010011001100110000001100110011000000110011001100000011001100110001001100110011000100110011001100000011001100110001001100110011000000110011001100010011001100110001001100110011000000110011001100010011001100110001001100110011000100110011001100000011001100110000001100110011000100110011001100000011001100110000001100110011000100110011001100010011001100110001001100110011000000110011001100000011001100110001001100110011000100110011001100000011001100110001001100110011000100110011001100010011001100110001001100110011000000110011001100000011001100110000001100110011000000110011001100010011001100110001001100110011000100110011001100000011001100110001001100110011000000110011001100000011001100110000001100110011000100110011001100010011001100110000001100110011000000110011001100010011001100110000001100110011000100110011001100000011001100110001001100110011000100110011001100000011001100110000001100110011000100110011001100000011001100110000'
shifted3 = '0011001100110000001100110011000100110011001100010011001100110001001100110011000000110011001100010011001100110000001100110011000000110011001100000011001100110001001100110011000000110011001100000011001100110000001100110011000000110011001100000011001100110000001100110011000000110011001100010011001100110001001100110011000000110011001100010011001100110000001100110011000000110011001100010011001100110000001100110011000100110011001100010011001100110001001100110011000100110011001100000011001100110000001100110011000100110011001100000011001100110000001100110011000100110011001100000011001100110000001100110011000000110011001100010011001100110000001100110011000000110011001100010011001100110001001100110011000000110011001100000011001100110000001100110011000000110011001100010011001100110000001100110011000100110011001100010011001100110001001100110011000100110011001100000011001100110000001100110011000100110011001100000011001100110000001100110011000100110011001100000011001100110000001100110011000000110011001100010011001100110000001100110011000000110011001100010011001100110001001100110011000100110011001100000011001100110001001100110011000000110011001100000011001100110000001100110011000100110011001100010011001100110000001100110011000000110011001100010011001100110000001100110011000100110011001100000011001100110000001100110011000100110011001100000011001100110001001100110011000000110011001100010011001100110000001100110011000000110011001100010011001100110001001100110011000000110011001100000011001100110000001100110011000000110011001100000011001100110000001100110011000100110011001100010011001100110000001100110011000000110011001100010011001100110001001100110011000100110011001100000011001100110000001100110011000100110011001100000011001100110000001100110011000000110011001100000011001100110000001100110011000000110011001100010011001100110001001100110011000000110011001100000011001100110001001100110011000000110011001100010011001100110000001100110011000100110011001100010011001100110000001100110011000000110011001100010011001100110000001100110011000000110011001100000011001100110001001100110011000100110011001100000011001100110001001100110011000000110011001100010011001100110001001100110011000000110011001100010011001100110001001100110011000100110011001100000011001100110000001100110011000100110011001100000011001100110000001100110011000100110011001100010011001100110001001100110011000000110011001100000011001100110001001100110011000100110011001100000011001100110001001100110011000100110011001100010011001100110001001100110011000000110011001100000011001100110000001100110011000000110011001100010011001100110001001100110011000100110011001100000011001100110001001100110011000000110011001100000011001100110000001100110011000100110011001100010011001100110000001100110011000000110011001100010011001100110000001100110011000100110011001100000011001100110001001100110011000100110011001100000011001100110000001100110011000100110011001100000011001100110000'
Final value =
't@iy"ay"te*`g edkrsxted'

None of the characters in the final value are equal to the original value (most of the time), and while you can obtain the same key, it would be hard to do (multiple guessing through \x00 sequences). This method I am guessing won't work well with small strings, but it's better with large files. I encrypted a 400 MB txt file in about a minute, and none of the characters remained the same, the keyword was "This is my keyword". I think it is a good method of encryption, I couldn't figure out how the dual key system works or anything. Or bit shifts and stuff like that. :/ it's really confusing, if anyone has any references to a site which can further explain encryption, it would be helpful :D
Also, what do you think of my encryption?


EDIT: Also, I just realized that the second shift appears to be 648 characters long xD So here's an issue with it, if your key value equals your message length, it'll have an issue >.<