Re: simple data encryption algorythm? by John
John
Thu Jun 30 12:02:45 CDT 2005
Hey Miria,
Can you give us a little more idea as to what acceptable security is? If
you're looking to keep honest people honest, Andrew's suggestion might fit.
If you're looking to keep honest but curious people honest anyway, maybe a
variation on that theme is all you need. If you're looking to keep those
with advanced training in cryptography from eventually cracking your code,
then as Ook mentioned, VFP probably is not your best choice.
For keeping the curious honest, you could add in something that uses the
same basic idea but varies the offset point based on some seed like a
customer ID value or the number of characters in the string. Every
calculation you add can further obfuscate the formula, but will conversely
effect performance.
FUNCTION EncryptWithSeed
LPARAMETERS InString, Seed
AlphaNum = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
!@#$%^&*()-_=+;:'" + '"' + "[{]}\|,<.>/?"
Offset = Seed % 40 + 13
RETURN CHRTRAN( InString, AlphaNum, SUBSTR( AlphaNum, Offset ) + LEFT(
AlphaNum, Offset - 1 ) )
Another idea might be to switch the encryption method per every X
characters. This would give the added benifit of keeping from deciphering
"clue" charatcters in a large block of text (like spaces).
FUNCTION EncryptWithSeedAndBreaks
LPARAMETERS InString, Seed
ReturnString = ""
FOR Cntr = 0 TO INT( LEN( InString ) /10)
ReturnString = ReturnString + EncryptWithSeed( SUBSTR( InString, 10 *
Cntr +1, 10 ), Seed + Cntr )
ENDFOR
RETURN ReturnString
AlphaNum = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
!@#$%^&*()-_=+;:'" + '"' + "[{]}\|,<.>/?"
Offset = Seed % 40 + 13
RETURN CHRTRAN( InString, AlphaNum, SUBSTR( AlphaNum, Offset ) + LEFT(
AlphaNum, Offset - 1 ) )
HTH,
John
"Miria" <mukas@soka.com> wrote in message
news:%23HK20MVfFHA.3612@TK2MSFTNGP12.phx.gbl...
> or maybe not... hmmm no, its not enough, too unsecure
>
> "Miria" <mukas@soka.com> wrote in message
> news:eycRxJVfFHA.2392@TK2MSFTNGP10.phx.gbl...
>> thnks, i think its enough for me;)
>>
>> "christophe" <irs.znospamforme@skynet.be> wrote in message
>> news:uYkBYAVfFHA.2156@TK2MSFTNGP14.phx.gbl...
>> > simple: yes
>> >
>> > Function ROT13
>> > Lparameters p_cStrIn
>> > return chrtran(p_cStrIn,
>> > "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwyz0123456789",
>> > "NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvzxyzabcdefghijklm5678901234")
>> >
>> > how to use it:
>> > pass a string to encrypt it.
>> > pass the encrypted to get the original value
>> >
>> > regards
>> > christophe
>> > --
>> > \|||/
>> > (o o)
>> > ----ooO-(_)-Ooo-------------
>> >
>> >
>> > "Andrew Howell" <ajh@work> schreef in bericht
>> > news:%23dnht5UfFHA.1284@TK2MSFTNGP14.phx.gbl...
>> > > "Miria" <mukas@soka.com> wrote in message
>> > > news:e94O20TfFHA.2840@tk2msftngp13.phx.gbl...
>> > >> hi,
>> > >> does anybody know any simple and FAST algorythm to encrypt data in
>> > >> the
>> > >> dbf fields?
>> > >> (except _crypt.vcx)
>> > >
>> > > ROT13
>> > > simple? check.
>> > > fast? check.
>> > > secure? hmmm.
>> > >
>> > > How secure should it be?
>> > >
>> >
>> >