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

  1. /*
  2.    Listing 20.8  Encrypt()
  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 encrypt(src_word,passkey)
  14. LOCAL pwd:="",jj,kk:=0,x
  15. passkey:=if(passkey=NIL,"CLIPPER",passkey)
  16. for jj=len(src_word) to 1 step -1
  17.    kk :=if(kk>len(passkey),1,kk)
  18.    x :=asc(substr(src_word,jj,1)) + asc(substr(passkey,kk,1))
  19.    pwd += chr(x)
  20. next
  21. return pwd
  22.  
  23. // end of file CHP2008.PRG
  24.