Here is another simple one- very simple one. This function will both encrypt and decrypt a string with a mask provided. A value of 0 for the mask will return the string as is.
Public Function Cipher(ByVal sData As String, ByVal nMask As Byte) As String
Dim nCount As Long, nIndex As Long
nCount = Len(sData)
For nIndex = 1 To nCount
Mid$(sData, nIndex, 1) = Chr$(Asc(Mid$(sData, nIndex, 1)) Xor nMask)
Next
Cipher = sData
End Function
SUN