'Code module
'Subs in this code module will be accessible from all modules.
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
End Sub
'"rotate by 13 places" substitution cipher
'http://en.wikipedia.org/wiki/ROT13
Public Sub ROT13(stringx As String) As String
Dim ByteX () As Byte
ByteX=stringx.GetBytes("UTF8")
Dim finalX As String
For x=0 To ByteX.Length-1
If (ByteX(x)>=97 AND ByteX(x)<=109 )OR (ByteX(x)>=65 AND ByteX(x)<=77 ) Then
ByteX(x)=ByteX(x)+13
Else If (ByteX(x)>=110 AND ByteX(x)<=122 )OR (ByteX(x)>=78 AND ByteX(x)<=90 ) Then
ByteX(x)=ByteX(x)-13
End If
finalX=finalX & Chr(ByteX(x))
Next
Return finalX
End Sub
'"Atbash" substitution cipher
'http://en.wikipedia.org/wiki/Atbash
Sub Atbash(StringX As String) As String
Dim ByteX () As Byte
ByteX=StringX.GetBytes("UTF8")
Dim finalX As String
'65-90 97- 122
For x=0 To ByteX.Length-1
If (ByteX(x)>=65 AND ByteX(x)<=90 ) Then
ByteX(x)=Abs(ByteX(x)-155) '155 comes from 65+90
Else If (ByteX(x)>=97 AND ByteX(x)<=122 ) Then
ByteX(x)=Abs(ByteX(x)-219) '219 comes from 97+122
End If
finalX=finalX & Chr(ByteX(x))
Next
Return finalX
End Sub