LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   encrypt the text ..... any hint pleas (https://www.linuxquestions.org/questions/linux-newbie-8/encrypt-the-text-any-hint-pleas-808940/)

bhb 05-19-2010 04:54 PM

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 :)

brucehinrichs 05-19-2010 05:31 PM

Hint for what? Maybe it's me, but I'm having a hard time finding your question.

grail 05-19-2010 06:27 PM

I agree, I cannot see a question here, save maybe the one that the teacher asked when he set this task.

bhb 05-20-2010 12:51 AM

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 =
ç Þ à Ë Þ Û Õ ™ Ü × Ü Ó

kurwongbah 05-20-2010 12:59 AM

Ehhhh, maybe it's me but welcomehome is size 11 and pythonpython is size 12!?

grail 05-20-2010 01:53 AM

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?"

kurwongbah 05-20-2010 05:26 PM

Quote:

Originally Posted by grail (Post 3975057)
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... ;)

PTrenholme 05-20-2010 05:46 PM

Are you sure that the ASCII values should simply be added?:scratch: 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.

anurupr 05-28-2010 01:51 PM

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.. :)

AnanthaP 05-28-2010 08:30 PM

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

anurupr 05-29-2010 02:04 AM

what does the 032 have to do with anything ?? i don't understand

goncalopp 05-29-2010 03:14 AM

Quote:

Originally Posted by anurupr (Post 3985048)
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.


All times are GMT -5. The time now is 08:41 AM.