Encryption + Python
I've looked through various web sites, and a few books.
Looking for a way to encrypt data via python. I designed my own chat client (It just conects to a server and sends information) I would now like this client to send the information with an encryption key. The message to send is simply a 'data = raw_input("Type message:")' I'd like it so, you input the data to send, and when you hit enter, it encrypts the data, and then sends the encrypted data through the server. Is this possible, with say md5 (The only encryption algorithm I know anything about) If so, how would I go about doing this? Heh.. |
This was an idea I was playing around with:
just convert each letter to a codeletter. then unconvert at the other end. just an idea. :) titanium_geek |
Yep.
It sends it from the client to the server all coded up, but when the client receives it again, it is uncoded. So, anyone got any ideas on how this would be done? :P |
First of all md5 is a one-way encryption algorithm, so it's no good for two-way communications. Secondly, just search the web for any encryption algorithm and you'll find plenty: blowfish, des, aes, skipjack, etc.
|
Strike is correct. MD5 is a hash. No matter how much data
you plug into MD5 you'll only get out 16 bytes (128bit). And that data is as good as lost. If you want the code to remain secret on the other side use a plain symmetric key algorithm. If you want to chat with your communications encrypted. Use a public key algorithm to exchange a symmetric key. And then use the shared symmetric key to encrypt on one side and then decrpyt on the other with the shared key. For an example check out OpenSSH. It's in C but it's really good. Titanium geek your algorithm is very weak People crack codes like that in newspaper cryptograms for something to do while they drink their coffee. All you have to do to break a code like that is count the frequencies of certain bytes. E will show up an awful lot. As will certain digraphs. I wrote a program to crack these kinds of codes automatically and I'm no crypto genius. There has been a major lesson learned in the crypto community over years and it is the strength of an algorithm must lie in the key and not the secrecy of the algorithm. I don't mean to be mean but you should take care never to encrypt anything you care to keep a secret with a mono-alphabetic cipher. |
LogicG8 - you'd be surprised how many otherwise experienced programmers make that same mistake.
|
yeha...
I knew the limitations to this program, just thought it would be a fun school project. Brainstorming. :] titanium_geek |
All times are GMT -5. The time now is 08:50 PM. |