home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.lang.c:18534 comp.lang.c++:18127 comp.lang.pascal:7550
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!sdd.hp.com!cs.utexas.edu!sun-barr!olivea!charnel!sifon!thunder.mcrcim.mcgill.edu!poly-vlsi!music.mus.polymtl.ca
- From: CT80@music.mus.polymtl.ca (Steph)
- Newsgroups: comp.lang.c,comp.lang.c++,comp.lang.pascal
- Subject: Re: Encryption algorythm/code needed...
- Message-ID: <13DEC92.17873883.0049@music.mus.polymtl.ca>
- Date: 13 Dec 92 21:32:59 GMT
- References: <Byt18n.6Cr@andy.bgsu.edu> <1992Dec7.160128.18678@sbcs.sunysb.edu> <1992Dec8.131745.13670@ncsu.edu>
- Sender: usenet@music.mus.polymtl.ca
- Organization: Ecole Polytechnique de Montreal
- Lines: 46
-
- In article <1992Dec8.131745.13670@ncsu.edu> jlnance@eos.ncsu.edu (JAMES LEWIS NANCE) writes:
- >
- >In article <1992Dec7.160128.18678@sbcs.sunysb.edu>, clane@csws2.ic.sunysb.edu (Charles F Lane) writes:
- >|>
- >|> >the usernames and passwords. The code need not be extravagent... I only
- >|> >need to encrypt single words (letters and numbers both).
- >|> >
- >
- >|> A very easy way to encrypt data is to use a random number generator. Suppose
- >|> you have a string "CHAIR". Assign a value to your random number generator's
- >|> seed. Then add random(256) to the ord of the first character (C, in this
- >|> case), then random(256) + ord("H"), random(256) + ord("A"), etc. When adding
- >|> the random number you should wrap around if the sum is > 255. In tp just
- >|> disable range checking. Decrypting is just as easy -- reassign the original
- >|> seed value and subtract the "random" number rather than adding. Code (TP) to
- >|> encrypt/decrypt a string follows:
- >|>
- >
- >Be careful if you use this, as it is not secure encode multiple things using
- >the same starting seed. For example, if you keep your entries like this:
- >
- >myusername:mypasswd
- >urusername:urpasswd
- >
- >And you encrypt each line using this method, starting with the same initial
- >seed, then I can take my username and password, which I know and figure out
- >what you added to them to encrypt them. Then I can subtract these numbers
- >from your username and your passwd. Since they were encrypted with the same
- >method and the same key, this will give me your unencrypted name and password.
- >
- >
- >
- >Jim
- >.
- >.
- I used the same method, with a variant : I would seed a new value to
- my random number generator, based on the current letter. So, you
- start the same way (one seed), but then the encrypted data will not
- be the same at all after but a few letters since the random number
- generator will be shooting 'totally' different numbers.
-
- <
-
-
- Steph.
- Who needs a .sig?
-