5750778 [rkeene@sledge /home/rkeene/devel/archive/visualbasic4.0]$ cat -n encrypt.bas
   1: 
   2: Function Decrypt$ (t$, ky$, o)
   3: Key$ = ky$
   4: For q = 1 To Len(t$)
   5: If q Mod o = 0 Then Key$ = Right$(Key$, 1) + Left$(Key$, Len(Key$) - 1)
   6: mm$ = mm$ + Chr$(InStr(Key$, Mid$(t$, q, 1)) - 1)
   7: Next q
   8: Decrypt$ = mm$
   9: End Function
  10: 
  11: Function Encrypt$ (t$, ky$, o)
  12: Key$ = ky$
  13: If Len(Key$) < 256 Then Exit Function
  14: For q = 1 To Len(t$)
  15: If q Mod o = 0 Then Key$ = Right$(Key$, 1) + Left$(Key$, Len(Key$) - 1)
  16: mm$ = mm$ + Mid$(Key$, (Asc(Mid$(t$, q, 1))) + 1, 1)
  17: Next q
  18: Encrypt$ = mm$
  19: End Function
  20: 
  21: 
  22: Function GenerateKey$ ()
  23: Do Until Len(c$) = 256
  24: Randomize Timer + (Abs((Len(c$) + 1) - (Len(c$) ^ 2))) + (Rnd * 11)
  25: 10 ac$ = Chr$(Int(Rnd * 1024) Mod 256)
  26: If InStr(c$, ac$) = 0 Then c$ = c$ + ac$ Else GoTo 10
  27: Loop
  28: GenerateKey$ = c$
  29: End Function
5750779 [rkeene@sledge /home/rkeene/devel/archive/visualbasic4.0]$

Click here to go back to the directory listing.
Click here to download this file.
last modified: 2000-05-09 21:52:29