FUNCTION Encrip
LPARAMETERS tccodigo, tnclave
PRIVATE lnlong AS INTEGER, ;
lnii AS INTEGER, ;
lcvalor AS STRING, ;
lcletra AS CHARACTER, ;
lnnumero AS INTEGER
tnclave = IIF(TYPE("tnclave")="N",IIF(tnclave>=128 AND tnclave <=255,tnclave,255),255)
lnlong = LEN(tccodigo)
lcvalor = ""
FOR lnii=1 TO lnlong
lnnumero = ASC(SUBS(tccodigo,lnii,1))
lnnumero = tnclave - lnnumero + 1
lnnumero = IIF(lnnumero<0,lnnumero*-1,lnnumero)
lcletra = CHR(lnnumero)
lcvalor = lcvalor + lcletra
NEXT lnii
RETURN lcvalor
ENDFUNC
les agradezco sus comentarios