← Foro de Visual FoxPro

ENCRIPTAR DBF

Hilo en el foro de Visual FoxPro · 21 de Abril del 2004 · 2 respuestas
Javier Molina21 de Abril del 2004
Pregunta
Por favor, necesito saber quien tiene experiencia con CRYPTOR o con cualquier otro software que encripte dbfs en visual foxpro.

Gracias

Respuestas 2

fernando21 de Abril del 2004
Proba esto, Encriptar/Desencriptar Datos en Cualquier Tabla con solo Abrirla


Cuantas veces nos pusimos a pensar en encriptar la data de nuestras aplicaciones ?
Aqui les dejo una rutina, modifiquenla a gusto

Aqui un Codigo para Encriptar/Desencriptar una tabla (Solo Campos Caracter)sin necesidad de especificar campos, Tan simple como :

*Do EncDesData With "ON" && Encripta
*Do EncDesData With "OFF" &&Desencripta


*Este Procedimiento Toma la Tabla Abierta, Lee Todos los campos caracter y los Encripta/Desencripta
*Nota Deben tener la Tabla Abierta
*
*Creditos Autor :John Harvey
*Modificado : Christian Gutman

*Ejemplos de uso
*Use TuTabla Excl
*Do EncDesData With "ON" && Encripta
*Do EncDesData With "OFF" &&Desencripta

Procedure EncDesData
LPARAMETERS LCENCR
maxno=100
LCENCR=UPPER(ALLT(LCENCR))
IF LCENCR<>'ON' AND LCENCR<>'OFF'
RETURN MESSAGEBOX("Pass ON or OFF for encryption/decryption!")
ENDIF
* loop through all fields in a table
LNFIELDS=FCOUNT()
FOR J = 1 TO LNFIELDS
LCFIELD=FIELD(J)
DO CASE
CASE TYPE(LCFIELD) $ 'CM'
* replace the all the contents of this particular field
REPL ALL &LCFIELD WITH CONVRT(LCENCR,&LCFIELD)
ENDCASE
ENDFOR
PROCEDURE CONVRT
lparameters lcencrypt,lcstring
if parameters()<2
messagebox('Pass two arguments, [On Off] and string')
return
endif
lcencrypt=upper(allt(lcencrypt))
* encrypt data
* take a string and shift the data to the right one place
if lcencrypt='ON'
lnlen=len(allt(lcstring))
lcnewstring=''
* convert the string to the value of the current string + the position
* number of the char in the string. A string of "ABC" would be converted
* to "BDF"
for i = 1 to lnlen
* asc(substring(lcstring,i,1)) for a "d" is 100
* so if the "d" were in the 1st position it would be converted
* to "e" via the following line
if i<maxno
lcchar=chr(asc(substr(lcstring,i,1))+i)
else
lcchar=chr(asc(substr(lcstring,i,1))+1)
endif
*build new string from converted characters
lcnewstring=lcnewstring+lcchar
endfor
RETVAL=LCNEWSTRING
ELSE
lnlen=len(allt(lcstring))
lcnewstring=''
for i = 1 to lnlen
* asc(substring(lcstring,i,1)) for a "d" is 100
* so if the "d" were in the 1st position it would be converted
* to "e" via the following line
if i<maxno
lcchar=chr(asc(substr(lcstring,i,1))-i)
else
lcchar=chr(asc(substr(lcstring,i,1))-1)
endif
*build new string from converted characters
lcnewstring=lcnewstring+lcchar
endfor
RETVAL=LCNEWSTRING
ENDIF
RETURN (RETVAL)

Jesus Miguel21 de Abril del 2004
enviame el codigo fuente para tener un poco mas de conocimiento en programacion
¿Buscas más hilos como este? Mira el foro de Visual FoxPro o usa el buscador.