Option Explicit
'Valid Characters for Password
Const Wheel1 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()_+=-{}[]:;<>,.?/"
'Replacemet For Wheel1 (Must be same with Wheel1 but make it Random)
Const Wheel2 = "89afi1jg2hbekAwxKBCFlmV=-cZrs3X#GY4.?/5tuOJ%^vyLnWzM{NP}[QR$EIoSpq;<>,T0*()67HUdD&!@_+]:"
Public Function EncryptString(xStr As String) As String
Dim xStrHolder As String
Dim xStrIndex As Integer
Dim i As Integer
For i = 1 To Len(xStr)
xStrIndex = InStr(Wheel1, Mid(xStr, i, 1))
If xStrIndex = 0 Then
MsgBox "Invalid use of character!...", vbExclamation, "Invalid Character"
Exit Function
Else
xStrHolder = xStrHolder & Mid(Wheel2, xStrIndex, 1)
End If
Next i
EncryptString = xStrHolder
End Function
Public Function DecryptString(xStr As String) As String
Dim xStrHolder As String
Dim xStrIndex As Integer
Dim i As Integer
For i = 1 To Len(xStr)
xStrIndex = InStr(Wheel2, Mid(xStr, i, 1))
If xStrIndex = 0 Then
MsgBox "Invalid use of character!...", vbExclamation, "Invalid Character"
Exit Function
Else
xStrHolder = xStrHolder & Mid(Wheel1, xStrIndex, 1)
End If
Next i
DecryptString = xStrHolder
End Function