LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-17-2003, 12:13 AM   #1
Chu
Member
 
Registered: Nov 2003
Location: Australia
Distribution: Slackware 9.1
Posts: 166

Rep: Reputation: 30
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..
 
Old 11-17-2003, 04:59 AM   #2
titanium_geek
Senior Member
 
Registered: May 2002
Location: Horsham Australia
Distribution: elementary os 5.1
Posts: 2,479

Rep: Reputation: 50
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
 
Old 11-17-2003, 02:49 PM   #3
Chu
Member
 
Registered: Nov 2003
Location: Australia
Distribution: Slackware 9.1
Posts: 166

Original Poster
Rep: Reputation: 30
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
 
Old 11-17-2003, 08:05 PM   #4
Strike
Member
 
Registered: Jun 2001
Location: Houston, TX, USA
Distribution: Debian
Posts: 569

Rep: Reputation: 31
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.
 
Old 11-17-2003, 08:50 PM   #5
LogicG8
Member
 
Registered: Jun 2003
Location: Long Island, NY
Distribution: Gentoo Unstable (what a misnomer)
Posts: 380

Rep: Reputation: 30
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.

Last edited by LogicG8; 11-17-2003 at 08:54 PM.
 
Old 11-18-2003, 09:52 AM   #6
jim mcnamara
Member
 
Registered: May 2002
Posts: 964

Rep: Reputation: 36
LogicG8 - you'd be surprised how many otherwise experienced programmers make that same mistake.
 
Old 11-18-2003, 06:14 PM   #7
titanium_geek
Senior Member
 
Registered: May 2002
Location: Horsham Australia
Distribution: elementary os 5.1
Posts: 2,479

Rep: Reputation: 50
yeha...
I knew the limitations to this program, just thought it would be a fun school project.
Brainstorming.
:]
titanium_geek
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Processing Conflict: python-devel conflicts python< 2.3.4-13.1 guarriman Fedora 2 04-23-2009 07:02 PM
installing python library's (Python Numeric) Four Linux - Newbie 1 10-16-2005 02:31 PM
WineX, python-gnome, and python-gtk DrD Fedora 0 08-03-2004 12:11 PM
install python 2.3 ,necssary to remove python 2.2 ngan_yine Linux - Newbie 7 12-28-2003 04:07 PM
Mandrake 9.0 Wireless Works without encryption.. does not with encryption topcat Linux - Wireless Networking 3 05-04-2003 08:47 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:50 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration