Simple Encryption Decryption

Public Function Encrypt(Name As String, Key As Long) As String

Dim v As Long, c1 As String, z As String

For v = 1 To Len(Name)

c1 = Asc(Mid(Name, v, 1))

c1 = Chr(c1 + Key) ‘ your public goes key here !

z = z & c1

Next v

Encrypt = z

End Function

Public Function Decrypt(Name As String, Key As Long) As String

Dim v As Long, c1 As String, z As String

For v = 1 To Len(Name)

c1 = Asc(Mid(Name, v, 1))

c1 = Chr(c1 – Key) ‘your public goes key here !

z = z & c1

Next v

Decrypt = z

End Function

Public Function RandomNumber(ByVal MaxValue As Long, Optional _
ByVal MinValue As Long = 0)

On Error Resume Next
Randomize Timer
RandomNumber = Int((MaxValue – MinValue + 1) * Rnd) + MinValue

End Function

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s