ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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..
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.