Linux - NewbieThis 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
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.
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
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 =
ç Þ à Ë Þ Û Õ ™ Ü × Ü Ó
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?"
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.
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..
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.