SimpleCypt




Dim Key As Integer
Key = (Int(Sqr(Len(SecretPassword) * 95)) + 21)
'For the string SecretPassword = "the toolbox", a key of 53

'would be generated using the algorithm above.

'To get real sneaky, you can play around with this code all you

'want, but this is only a start!

'Here is the magic code to do the encryption. If you'll notice, it is the same encryption code used in the

'screen saver template.

Function Encrypt (Text As String, EncryptKey As Integer)
Dim Temp As String, RR As Integer
For RR = 1 To Len(Text)
Temp$ = Temp$ + Chr$(Asc(Mid(Text, RR, 1)) Xor EncryptKey)
Next RR
Encrypt = Temp
End Function

Simple cryptography
Note: I mean simple. These codes are easily cracked!

Install a bit of security to your applications. This simple
encryption function can serve as both the encoder and
decoder. In order for this to work properly, you must use
the same numerical key each time.
For example,

lets say you have a string, SecretPassword, that is equal
to 'the toolbox', and you wish to encrypt it.

Call the following:

SecretPassword = Encrypt(SecretPassword, 80)

In this case you are using an encryption key of 80. So,
the end result would give you a value of '$85p$??<2?(
. in order to decode it, simply reverse the process, but be
sure to use the right key!. in real world applications, you
might want to create keys on the fly using a math algorithm
and the len statement as a known base, such as:










( simplecypt.html )- by Paolo Puglisi - Modifica del 17/12/2023