hello all, i need some help implementing my 'context engine' encryption, preferably in python to ease porting.
i'm not a good programmer, so i need someone to help me out, maybe even code some stuff
klamath
09-29-2001, 01:18 AM
WTF is "context engine" encryption? Can you give us some information on what you're trying to do?
Is there a reason why you can't just use OpenSSL or NSS?
sasKuatch
10-08-2001, 09:00 PM
sorry about the long delay, but i had to format, um, that's just it it's not mathematical or an algorithm, it's a proceedure well here goes:
1. you take the word 'hello'
2. you add the unused letters (the ones besides h, e, l, and o) lets say 100 of each to allow for longer messeges
3. you scramble it
now, i ask you how can you decipher that? no language patterns, no context, no frequency distributions, nada, please post back
Gnu/Vince
10-08-2001, 09:05 PM
You're saying you don't know much about programming? How about trying to do a simple calculator that will handle exceptions or something before?
jemfinch
10-08-2001, 09:07 PM
Originally posted by sasKuatch:
now, i ask you how can you decipher that?
Encryption algorithms that can't be deciphered aren't very useful.
Jeremy
sasKuatch
10-08-2001, 09:07 PM
true, but i'm pressed for time, and i got he core down, it's really simple, i just need some help making it usable to normal people
jkm
10-08-2001, 09:08 PM
care to share how you scramble it?
you'd be suprised what skilled people can do with math.
sasKuatch
10-08-2001, 09:09 PM
actually, you can decipher it, just not crack it, you just need to know the position of the important characters
sasKuatch
10-08-2001, 09:10 PM
man, this is taking off, well, you just randomize the position of the letters (my mistake for not specifying that before)
jkm
10-08-2001, 09:12 PM
if it is impossible to decipher, then it is also impossible for the person who originally enciphered it to decipher it. if not, it's not very useful and would be easier to just remove the file or fill it full of /dev/random.
sasKuatch
10-08-2001, 09:12 PM
sorry misunderstood you post
uhm, that shouldn't matter much (theoretically, if it's perfectly randomizes, you can't predict it)
sasKuatch
10-08-2001, 09:14 PM
well, it is just junk, the key is actually the message, you could have the same message block each time and just change the key, and you'd have a differnt messege
jkm
10-08-2001, 09:18 PM
alright, i don't know if i'm just tired, but i cannot make any sense out of what you are saying.
want to repeat the details, in clear english, so we can deliver a verdict?
tecknophreak
10-08-2001, 10:22 PM
let me see if i understand the procedure.
you have a message, "hello" then place those letters "randomly" throughout a big mess of the other letters in the alphabet. it uses a specific randomizer for the positions so that the user on the other side can decypher it. sound about right?
why then, since the message goes in specific locations, would you want to use only the other letters of the alphabet to make the rest of the mess? it seems this would make it easier to decode and harder to keep encoded, security-wise. if this is for a class, it can be created easily in c++. i'd just use a better encryption, unless i'm not understanding this correctly. although, the larger the plain-text, the stronger this gets i suppose.
pinoy
10-09-2001, 03:58 AM
What kind of encryption program are you trying to make? Sounds like this goes only one way, which is for most cases useless, unless it produces the same ciphertext given the same plaintext each time.
A normal symmetric encryption is usually composed off a plain text, a key, and a cipher. It is also reversible with the aid of the key. Are you trying to say, you can't decrypt this message?
Anyway if you don't understand security it is likely to be very insecure. Anyway, if you just want to play around with scrambling plain text, a simple solution is generating a stream of random characters that is predictable (if you know the key) and xoring it with your plaintext. e.g. the rand() function is predictable if you know what your seed is.
eg
The problem with this (cryptographically) is that our keystream (random source) is very weak.
sasKuatch
10-09-2001, 12:05 PM
well, ok, i have been reading up on encryption for several years now, and i have looked at code, and have seen what works and what doesn't
here's what mine is based on (encyclopedia brittanica):
two stock broker people want to communicate a message over an insecure phone line, ok. one of them (sender, lets call him A) says either Yes or No, depending on what he want B, the reciever to do. now, lets say that they agree ahead of time whether to tell the truth or lie (either equally likely). that way any listening party only has a 50/50 chance of interpreting the message right, but with only two possible outcomes, he might as well guess (eavesdropping does not improve his chances of figuring out what the heck their saying)
in short, this method is mathematically uncrackable
my method is sort of the same, in that machines can't just try random possibilities (as far as i know), because out of a jumble of letters, say 100 of each, you can make any messege you want to
i guess, in a way it is one-way, but if you have the key (knowledge of what part of the message is relevant) you can figure it out, and only then.
the reason you fill in the messege block with the remaining letters is to have an equal number of each letter in the final output, because crackers can go on how many times each letter occurs
you randomize it (not just some wusy c++ randomize func, but an actual rathematically perfectly unpredictable-type random) to get rid of any patterns, such as double-letters (like in 'hello') and any other language patterns associated to context, plurals, you name it, etc
well, i really appreciate this discussion, post some more, thanks! :)
Dru Lee Parsec
10-09-2001, 02:27 PM
OK, but for another person to decrypt the message they need to know how the original message was randomized.
To help us better understand how your encryption algorithm is suppose to work let me suggest the following:
Let's use this shortened alphabet of only 13 letters
A B C D E F G H I J K L M
I want to send the message
"I Am Dad"
Using only these 13 letters could you step through how your algorithm would build a 13 letter long encrypted text string? If we can see that then I think it would clear up a lot of our questions.
Thanks
pinoy
10-09-2001, 04:26 PM
Ron Rivest wrote a paper similar to what you are describing. I think it was something called chaffing and winnowing. You might find it using google.
sasKuatch
10-11-2001, 12:02 PM
thanks, i'll have to look that up
regarding the simplified alphabet, it shouldn't matter what order it is scrambled in, as the key is actually the offset at which the program accesses the string or codeblock (i believe this is called 'slicing' in Python)
lets say the 13 letters woulde be like this
CDGIJAEMLBHDF
to simplify the offsets, lets put some junk in front of it to make them 2 digits
like
000000000CDGIJAEMLBHDF
now the key to print "I AM DAD" would have to be 131517211521 separated every 2 digets to ease slicing and indexing by the program
every 2 digets is a double-diget offset
the 'I' is the 13th letter, the 'A' is the 15th etc.
notice how a poor/patterned choice of 'randomizing' leads to obvious patterns, but i'm pressed for time now, i'm in the computer lab, just 5 mins. from my next class
but anyway, keep posting, i appreciate it
Dru Lee Parsec
10-11-2001, 02:56 PM
How 'bout this:
The schema I'm about to describe is still very breakable, but it's way better than a simple substitution.
Take your randomized text
CDGIJAEMLBHDF
Now rotate it by one letter 13 times
CDGIJAEMLBHDF
DGIJAEMLBHDFC
GIJAEMLBHDFCD
IJAEMLBHDFCDG
JAEMLBHDFCDGI
AEMLBHDFCDGIJ
and so on . . .
Now, assign a letter to each of these rotated keys.
ABCDEFGHIJKLM Maps to
CDGIJAEMLBHDF I
DGIJAEMLBHDFC A
GIJAEMLBHDFCD M
IJAEMLBHDFCDG D
JAEMLBHDFCDGI A
AEMLBHDFCDGIJ D
Which gives you LDDEJL
Notice that the A's and D's in the plain text don't map to the same letter in the encrypted text AND that the same letter in the encrypted text (L for example) does not always map back to the same letter in plain text.
It's still breakable (see "The Code Book : The Science of Secrecy from Ancient Egypt to Quantum Cryptography" by Simon Singh ) But it's way harder than a simple substitution.
Problem 1: You and your receiver still need to agree on a key.
Problem 2: You both need to agree on a rotation direction
Cool obfuscation technique. Once the text is encrypted. Select a few pairs of letters (Like L and D ) and swap them in every instance of the encrypted text. This would change the above encrypted text to
DLLEJD
This absolutly does not map back to understandable plain text, especially if you use 5 or 6 of these swappings. (This was one of the techniques used with the Enigma machine) It's still breakable, but it adds another level of difficulty.
pinoy
10-11-2001, 04:39 PM
Sounds more like steganography to me than encryption.
Dru Lee: Is that the vigenere cipher your describing?
kmj
10-11-2001, 04:54 PM
Originally posted by pinoy:
<STRONG>Dru Lee: Is that the vigenere cipher your describing?</STRONG>
nope; the viginere is similar in a way... pick a key word; then for each letter in the plaintext map it based on rotate(key[x % n]), where x is the position of the letter in the plaintext and n is the length of the key... So if the keyword were BAD, letters 0, 3, 6, etc would be shifted by 1 (for B), letters 1, 4, 7, etc would be shifted by 0 (for A), and letters 2, 5, 8, etc would be rotated by 3 (for D)... so the ciphertext of "hello cryptography" would become
I do think that's different from what dru was doing.
[ 11 October 2001: Message edited by: kmj ]
pinoy
10-12-2001, 04:46 AM
That's not vigenere your describing kmj. With vigenere you basically build up a matrix similar to what Dru Lee's described
e.g.
a b c d e f g h i j k l ....
a A B C D E F G H I J K L
b B C D E F G H I J K L M
c C D E F G H I J K L M N
d D E F G H I J K L M N O
e E F G H I J K L M N O P
f F G H I J K L M N O P Q
g G H I J K L M N O P Q R
....
Now let say you want to encrypt:
FEED DAD
and your key is:
CAD
You lay it out as:
CADCADC
FEEDDAD
-------
To find the cipher text find the intersection by using the key as an index on the x axis and the plain text on the y axis.
This would encrypt to:
HEHFDDF
This is not as vulnerable to frequency analysis attack as a simple monoalphabetic cipher is.
Encryption algorithms that can't be deciphered aren't very useful.
Jeremy
Of course it is, there are many one way ciphers out there. This is the same as saying number theory aren't very useful until someone actually finds a use for it (such as cryptography).
[ 12 October 2001: Message edited by: pinoy ]
sasKuatch
10-12-2001, 10:56 AM
i have changed my sceme a little, tell me if this makes sense:
you just have a plain alphabet with numbers and symbols
notice the space between the letters and numbers, it's a character too,
now, no matter what the length of the plaintext, the ciphertext is still that above alphabet, just in a different order. you don't need to list every single letter used, you just need to reference it with the key.
i don't know if this makes sense, but the message (ciphertext) can stay the same, the key actually makes the message. that way, changing the order of the message alphabet, while leaving the key the same changes the message too. so if in the above message you have the key be
but still, if you have multiple letters and other symbols in the message block, it would eliminate the doubling of the numbers in the key and the 'bb' in the new plaintext, so actually (forgive my ramblings) it would be better to stick with multiples of each letter (the message would have for example 100 a's, 100 b's, and so on)
sasKuatch
10-12-2001, 10:57 AM
by the way, could someone PLEASE tell me how i could randomize a string of letters, that way i could actually show you guys how it's done rather than just ramble on like this
sasKuatch
10-15-2001, 10:01 AM
ppl.. um, i don't have internet access at home right now, so i might be a little slow on reply's but i still really need the help
kmj
10-15-2001, 10:09 AM
Originally posted by pinoy:
<STRONG>That's not vigenere your describing kmj. With vigenere you basically build up a matrix similar to what Dru Lee's described
e.g.
</STRONG>
Yes it is; you don't need to build up a matrix, all the matrix represents does is represent the shift without having to actually add anything.
FEEDDAD
2032032 +
HEHFDDF
It the exact same thing you did.
sasKuatch
10-15-2001, 05:37 PM
i see what your doing. now, you don't need to replace any of the letters really, if their mixed up with others, oh hell, this aint gonna work, here goes:
"I bet you all that i have the best encryption algorithm ever invented and it can't be cracked at all, if you think i'm wrong (which i hope you do) then please tell me how to do the following (preferably in python):
1. take a huge string and scramble it, while keeping certain letters in predeterminded possitions.
OR
2. how to create a big matrix and scramble it in the way as the above string.
-sincerely sasKuach"
there, is that more like it? or do i have to get down on my hands and knees to plead for help? people, all i need is some simple programming advice
sasKuatch
10-15-2001, 05:41 PM
>>jkm, its practically is output from /dev/random, i just need to organize it a bit, you'r the only one that actually got it right so far
Aragorn
10-17-2001, 07:05 AM
Well I don't know about any algorithms, you'll have to talk to the math geniuses on this board to do that, but here is a quick simple program to randomize letters and numbers, plus a few symbols.
import random
def main():
count = 0
teststr = ""
while 1:
count = count + 1
test = random.randrange(48, 90)
teststr = teststr + chr(test)
if count == 100:
break
print teststr
main()
I don't know if that is what your trying to get at, but it works as far as I can tell. I don't know if it is "perfectly" random or not, you would have to define perfectly random!
Aragorn
Admin of GetLinuxOnline.Com
[ 17 October 2001: Message edited by: Aragorn ]
justlinux.com
Copyright Internet.com Inc. All Rights Reserved.