Question : Encrypt a password in ini file

Hi There,

I have an access form wich read an write certain settings to an ini file.
One of the settings is a password, and i would like to encrypt this password when it's written to the ini file, and decrypted when ist read into the form.
The rest of the settings should be written in clear text.

Gijsbert Sonnevelt

Answer : Encrypt a password in ini file

You did not mention the security of encryption you want, Here is a simple substitution scheme. You can change the 7 (and -7) to another number.  To use it:

Encrypt:
EncryptedString = EncryptString ("Hello There")
Decrypt:
DecryptedString = EncryptString ("A^eehMa^k^", True)


Function EncryptString(strInput As String, Optional Decrypt As Boolean = False) As String
Dim i As Integer
For i = 1 To Len(strInput)
    EncryptString = EncryptString & Chr(Asc(Mid(strInput, i, 1)) + IIf(Decrypt, 7, -7))
Next i
End Function
Random Solutions  
 
programming4us programming4us