home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a012 / 1.ddi / CHAP20.EXE / CHP2009.PRG < prev   
Encoding:
Text File  |  1991-04-30  |  642 b   |  24 lines

  1. /*
  2.    Listing 20.9  Decrypt()
  3.    Author: Joe Booth
  4.    Excerpted from "Clipper 5: A Developer's Guide"
  5.    Copyright (c) 1991 M&T Books
  6.                       501 Galveston Drive
  7.                       Redwood City, CA 94063-4728
  8.                       (415) 366-3600
  9. */
  10.  
  11. //───── NOTE: must compile with the /N option!
  12.  
  13. function decrypt(enc_word, passkey)
  14. LOCAL plain:="",jj,kk:=0,x
  15. passkey := if(passkey==NIL,"CLIPPER",passkey)
  16. for jj=len(enc_word) to 1 step -1
  17.    kk :=if(kk>len(passkey),1,kk)
  18.    x  :=asc(substr(enc_word,jj,1)) - asc(substr(passkey,kk,1))
  19.    plain += chr(x)
  20. next
  21. return plain
  22.  
  23. // end of file CHP2009.PRG
  24.