LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-19-2010, 04:54 PM   #1
bhb
LQ Newbie
 
Registered: May 2010
Posts: 5

Rep: Reputation: 0
encrypt the text ..... any hint pleas


i want help for this issue if u can help me !!!!

To encrypt the text, we take the word "python" and make it at least the same size as "welcome
home" by repeating it as follows:
w e l c o m e h o m e
p y t h o n p y t h o n

Then, we convert each letter into its numerical ASCII value as follows:
w e l c o m e h o m e = 119 101 108 099 111 109 101 032 104 111 109 101
p y t h o n p y t h o n = 112 121 116 104 111 110 112 121 116 104 111 110
Next, we add the numbers together.
119 101 108 099 111 109 101 032 104 111 109 101
+ 112 121 116 104 111 110 112 121 116 104 111 110
--------------------------------------------------
231 222 224 203 222 219 213 153 220 215 220 211

And, finally, we convert the numbers back into their corresponding ASCII character:


any hint will be v.good
as soon as possible if u can replay
thnx
 
Old 05-19-2010, 05:31 PM   #2
brucehinrichs
Member
 
Registered: Mar 2008
Location: US
Distribution: Debian Sid; Sabayon, UbuntuStudio, Slackware-multilib 13.1, Peppermint Ice, CentOS
Posts: 575

Rep: Reputation: 69
Hint for what? Maybe it's me, but I'm having a hard time finding your question.
 
Old 05-19-2010, 06:27 PM   #3
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,006

Rep: Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191
I agree, I cannot see a question here, save maybe the one that the teacher asked when he set this task.
 
Old 05-20-2010, 12:51 AM   #4
bhb
LQ Newbie
 
Registered: May 2010
Posts: 5

Original Poster
Rep: Reputation: 0
can u help me in this :(

am trying to genarate a programm

that will take a text file as input, either encrypt or decipher the text using a keyword cipher (Vigenere cipher), and save the modified text file. The program should ask the user for the keyword to use in the cipher, whether the file needs to be encrypted or deciphered, and the name of both the input file and the output file.


To encrypt the text, we take the word "python" and make it at least the same size as "welcome home" by repeating it as follows
: w e l c o m e h o m e
p y t h o n p y t h o n

Then, we convert each letter into its numerical ASCII value as follows: w e l c o m e h o m e = 119 101 108 099 111 109 101 032 104 111 109 101 p y t h o n p y t h o n = 112 121 116 104 111 110 112 121 116 104 111 110
Next,
we add the numbers together.
119 101 108 099 111 109 101 032 104 111 109 101 +
112 121 116 104 111 110 112 121 116 104 111 110
--------------------------------------------------
231 222 224 203 222 219 213 153 220 215 220 211

finally
we convert the numbers back into their corresponding ASCII character: 231 222 224 203 222 219 213 153 220 215 220 211 =
ç Þ à Ë Þ Û Õ ™ Ü × Ü Ó
 
Old 05-20-2010, 12:59 AM   #5
kurwongbah
Member
 
Registered: Apr 2010
Posts: 82

Rep: Reputation: 24
Ehhhh, maybe it's me but welcomehome is size 11 and pythonpython is size 12!?
 
Old 05-20-2010, 01:53 AM   #6
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,006

Rep: Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191
Quote:
Ehhhh, maybe it's me but welcomehome is size 11 and pythonpython is size 12!?
Don't ruin the question with facts ... sheesh you just looking to slow us down .. lol
Seems the space may be included.

OP - That seems like quite a good exercise, but I would ask again, what is your question?
At the moment it reads like this - "I have an assignment and would like you to do it for me?"
 
Old 05-20-2010, 05:26 PM   #7
kurwongbah
Member
 
Registered: Apr 2010
Posts: 82

Rep: Reputation: 24
Quote:
Originally Posted by grail View Post
Don't ruin the question with facts ... sheesh you just looking to slow us down .. lol
Seems the space may be included.
No negative feedback intended, I was actually trying to get the problem stated correctly to start solving...
 
Old 05-20-2010, 05:46 PM   #8
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,187

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
Are you sure that the ASCII values should simply be added? The problem is much easier if the addition is done mod 256, and even easier if you use an XOR function to combine the plain text and the key. If the XOR is used, a second XOR of the key will recover the plain text.
 
Old 05-28-2010, 01:51 PM   #9
anurupr
Member
 
Registered: Mar 2010
Posts: 71

Rep: Reputation: 16
i made a software which does the encryption

only thing is i didnt add your ascii values .. i made a much simpler version of it ... i used a look up table to convert those numbers into a alphabets... for example if we have a string ... hello world ... the ascii values of the characters in the string including space is 104 101 108 108 111 32 119 111 114 108 100 .. now this is how the string of numbers would appear .. 10410110810811132119111114108100 ..now what i did is .. i made a look up table ( a= 0,b=1.. j=9)...and convert those numbers into characters so now the string would look like this .. baebabbaibbbdjbbbbbebaibaa.. its just a suggestion..
 
Old 05-28-2010, 08:30 PM   #10
AnanthaP
Member
 
Registered: Jul 2004
Location: Chennai, India
Posts: 952

Rep: Reputation: 217Reputation: 217Reputation: 217
Quote:
Ehhhh, maybe it's me but welcomehome is size 11 and pythonpython is size 12!?
Noticed the 032 for space?
Quote:
119 101 108 099 111 109 101 032 104 111 109 101
I was also told about a site called "hashcalc" or something that provides readymade routines and windows to input data and get the crypted output.

End
 
Old 05-29-2010, 02:04 AM   #11
anurupr
Member
 
Registered: Mar 2010
Posts: 71

Rep: Reputation: 16
what does the 032 have to do with anything ?? i don't understand
 
Old 05-29-2010, 03:14 AM   #12
goncalopp
Member
 
Registered: Jun 2008
Posts: 47

Rep: Reputation: Disabled
Quote:
Originally Posted by anurupr View Post
what does the 032 have to do with anything ?? i don't understand
32 is the decimal representation of whitespace, in ascii

@bhb:
This is a linux forum, not a programming one.
Ignoring that, it seems you are basically asking for someone to do your homework for you, as has already been said.
Further ignoring *that*, you have not specified a language, so, even if we want to, we can't help you as it stands. PTrenholme raised a valid point. It isn't just easier to use XOR or modular arithmetics, you simply *can't* use addition, or your bytes will overflow - unless, of course, you use 7bit ascii for both the key and the plaintext and 8bit for ciphertext, or something like that.

There are numerous resources around the web dealing with this kind of simple encryption. You may want to google for 'XOR cipher'. Basic file I/O isn't too difficult to find either, in any language of your choice.

Last edited by goncalopp; 05-29-2010 at 06:21 AM.
 
  


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
crypt() perl function to encrypt Password in shell scripts or How Encrypt passwords ? balakrishnay Linux - General 13 01-14-2010 09:35 AM
With which program can we encrypt/decrypt text cross-plaftorm? frenchn00b Linux - Software 5 10-24-2009 04:20 PM
encrypt and decrypt using encrypt(char block[64], int edflag) rockwell_001 Linux - Security 3 08-30-2009 09:16 AM
No-name server, weird problem, pls hint-hint ButterflyMelissa Linux - Server 0 04-06-2009 12:21 PM
GPG encrypt text in terminal max-ebb Linux - Security 3 10-06-2004 06:51 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:27 AM.

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