home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / c / 18534 < prev    next >
Encoding:
Internet Message Format  |  1992-12-17  |  2.5 KB

  1. Xref: sparky comp.lang.c:18534 comp.lang.c++:18127 comp.lang.pascal:7550
  2. 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
  3. From: CT80@music.mus.polymtl.ca (Steph)
  4. Newsgroups: comp.lang.c,comp.lang.c++,comp.lang.pascal
  5. Subject: Re: Encryption algorythm/code needed...
  6. Message-ID: <13DEC92.17873883.0049@music.mus.polymtl.ca>
  7. Date: 13 Dec 92 21:32:59 GMT
  8. References: <Byt18n.6Cr@andy.bgsu.edu> <1992Dec7.160128.18678@sbcs.sunysb.edu> <1992Dec8.131745.13670@ncsu.edu>
  9. Sender: usenet@music.mus.polymtl.ca
  10. Organization: Ecole Polytechnique de Montreal
  11. Lines: 46
  12.  
  13. In article <1992Dec8.131745.13670@ncsu.edu> jlnance@eos.ncsu.edu (JAMES LEWIS NANCE) writes:
  14. >
  15. >In article <1992Dec7.160128.18678@sbcs.sunysb.edu>, clane@csws2.ic.sunysb.edu (Charles F Lane) writes:
  16. >|>
  17. >|> >the usernames and passwords.  The code need not be extravagent...  I only
  18. >|> >need to encrypt single words (letters and numbers both).
  19. >|> >
  20. >
  21. >|> A very easy way to encrypt data is to use a random number generator.  Suppose
  22. >|> you have a string "CHAIR".  Assign a value to your random number generator's
  23. >|> seed.  Then add random(256) to the ord of the first character (C, in this
  24. >|> case), then random(256) + ord("H"), random(256) + ord("A"), etc.  When adding
  25. >|> the random number you should wrap around if the sum is > 255.  In tp just
  26. >|> disable range checking.  Decrypting is just as easy -- reassign the original
  27. >|> seed value and subtract the "random" number rather than adding.  Code (TP) to
  28. >|> encrypt/decrypt a string follows:
  29. >|>
  30. >
  31. >Be careful if you use this, as it is not secure encode multiple things using
  32. >the same starting seed.  For example, if you keep your entries like this:
  33. >
  34. >myusername:mypasswd
  35. >urusername:urpasswd
  36. >
  37. >And you encrypt each line using this method, starting with the same initial
  38. >seed, then I can take my username and password, which I know and figure out
  39. >what you added to them to encrypt them.  Then I can subtract these numbers
  40. >from your username and your passwd.  Since they were encrypted with the same
  41. >method and the same key, this will give me your unencrypted name and password.
  42. >
  43. >
  44. >
  45. >Jim
  46. >.
  47. >.
  48. I used the same method, with a variant : I would seed a new value to
  49. my random number generator, based on the current letter.  So, you
  50. start the same way (one seed), but then the encrypted data will not
  51. be the same at all after but a few letters since the random number
  52. generator will be shooting 'totally' different numbers.
  53.  
  54. <
  55.  
  56.  
  57. Steph.
  58. Who needs a .sig?
  59.