1. Re: Data Encryption
- Posted by Robert B Pilkington <bpilkington at JUNO.COM>
Jun 18, 1998
-
Last edited Jun 19, 1998
On Thu, 18 Jun 1998 22:15:57 -0400 Alan Tu <ATU5713 at COMPUSERVE.COM>
writes (A couple hours ago :) :
>Robert B Pilkington wrote (a month ago):
>>This is how mine works:
>>
>>It gets and confirms the password
>>It performs calculations on the password (adding the ASCII values up
>>and such and a little bit more) to get a number.
>>Seeds the randomizer to the number (set_rand(number))
>>Takes each character in the file, and adds a random number between 1
>>and 255 to it and puts it into the output file. (or subtracts in
>>decryption)
>I think I can learn some low-level concepts from this algorithm.
There isn't anything really low-level about it...
>Are you using ASCII values or bits? There are eight bits in a byte.
>So if you add 1 to 255 to eight bits, you got a 9-bit number. How
>can you write byte-for-byte? Similar thing for ASCII values.
I use integers. If the number overflows (goes beyond 255 or below 0),
then I bring the number back into range. (A remainder(new_number, 256)
should do it, but I simply subtract (or add, if it's decrypting) 256 to
it to bring it back to it's allowed range.)
By using getc() and puts(), I get the data character (byte) by character,
and process each one individually.
_____________________________________________________________________
You don't need to buy Internet access to use free Internet e-mail.
Get completely free e-mail from Juno at http://www.juno.com
Or call Juno at (800) 654-JUNO [654-5866]