home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / lang / pascal / 6681 < prev    next >
Encoding:
Internet Message Format  |  1992-11-18  |  1.6 KB

  1. Path: sparky!uunet!olivea!charnel!rat!usc!zaphod.mps.ohio-state.edu!cs.utexas.edu!torn!news.ccs.queensu.ca!mast.queensu.ca!dmurdoch
  2. From: dmurdoch@mast.queensu.ca (Duncan Murdoch)
  3. Newsgroups: comp.lang.pascal
  4. Subject: Re: Encryption and Random Numbers
  5. Message-ID: <dmurdoch.285.722096509@mast.queensu.ca>
  6. Date: 18 Nov 92 14:21:49 GMT
  7. References: <1992Nov17.211502.18511@lynx.dac.northeastern.edu>
  8. Sender: news@knot.ccs.queensu.ca (Netnews control)
  9. Organization: Queen's University
  10. Lines: 28
  11.  
  12. In article <1992Nov17.211502.18511@lynx.dac.northeastern.edu> cschmidt@lynx.dac.northeastern.edu (Christopher Schmidt) writes:
  13. >Duncan Murdoch's interesting STREAMS package includes some
  14. >clever encryption logic that uses the TP random number
  15. >generator.  It's a nice technique, except that if Borland
  16. >modifies the TP random number generator, then you and your
  17. >customers will be locked out of your encrypted data.
  18.  
  19. That's a good point.   I have Pascal code that is equivalent to the TP 6 
  20. random number generator; I'll include it in the next Streams release.  It's 
  21. not nearly as fast as the real thing, so it'll be a conditional include, 
  22. depending on the compiler version.  
  23.  
  24. Once I dig up the code, I'll post it here.  You could figure it out yourself,
  25. pretty easily:  It's of the form
  26.  
  27.   RandSeed := A*RandSeed + B;
  28.  
  29. and I think B is 1.  If you're using TP/BP 7, be sure to compile it with 
  30. overflowchecking turned off.  There's an implicit "mod 2^32" in there that's 
  31. essential.
  32.  
  33. Come to think of it, the new longint optimizations might make the Pascal 
  34. version competitive with the RTL version.  I'll have to do some timings.
  35.  
  36. Duncan Murdoch
  37.  
  38. Duncan Murdoch
  39. dmurdoch@mast.queensu.ca
  40.