PDA

Click to See Complete Forum and Search --> : Encryption


chrisjk
Dec 1st, 1999, 08:38 AM
Hi

Does anyone know of a real beefy encryption function that I can use to store gibberish in the registry, but can be read by my program. I've got one that replaces one character with another, but that seems shockingly easy to figure out (look at enough examples and what has been replaced by what is easy to work out!)

Thanks in advance,

------------------
- Chris
chris.kilhams@btinternet.com
If it ain't broke - don't fix it :)

SteveS
Dec 1st, 1999, 01:04 PM
Use an XOr function, like the following, unless you know the lngKey value you won't deciper it. You could make it more cryptic if you use groups of characters and a bigger lngKey value.

Private Function Crypt(MyString as String) as String
Dim n As Long, lngKey As Long, tmpString As String
lngKey = 255
For n = 1 To Len(strInput)
tmpString = tmpString + Chr(lngKey Xor Asc(Mid(MyString, n, 1)))
Next n
Crypt = tmpString
End Sub

Usage:
EncryptedString = Crypt(NormalString)
NormalString = Crypt(EncryptedString)

Just an idea,
Steve.

chrisjk
Dec 1st, 1999, 05:43 PM
Thanks steve, i'll give it a shot later.

cheers

regards,

------------------
- Chris
chris.kilhams@btinternet.com
If it ain't broke - don't fix it :)

chrisjk
Dec 1st, 1999, 07:56 PM
Steve - it just returns nothing, I don't know if it's a zero=length string, null or what, but Msgbox shows up as nothing and so does putting encrypted string in a textbox

I used...

Text2.Text = Crypt(Text1.Text)

Any ideas?

Thanks for your time

Kind regards,

------------------
- Chris
chris.kilhams@btinternet.com
If it ain't broke - don't fix it :)