Attribute VB_Name = "modXORencrypt"
'Encryption Mod - will later be replaced with stronger encryption - hence Encrypt and Decrypt are used with simple XOR
'MODIFIED FOR USE WITH BWW-IRC
'BY : Bryan Hurley

Public Function DeCrypt(Text As String, key As String) As String
    Dim a As Integer
    Dim b As Integer
    Dim RetVal As String
    b = 1
    For a = 1 To Len(Text)
        RetVal = RetVal & Chr(Asc(Mid(Text, a, 1)) Xor Asc(Mid(key, b, 1)))
        b = b Mod Len(key) + 1
    Next a
    DeCrypt = RetVal

End Function

Public Function EnCrypt(Text As String, key As String) As String
    
    Dim a As Integer
    Dim b As Integer
    Dim RetVal As String
    b = 1
    For a = 1 To Len(Text)
        RetVal = RetVal & Chr(Asc(Mid(Text, a, 1)) Xor Asc(Mid(key, b, 1)))
        b = b Mod Len(key) + 1
    Next a
    EnCrypt = RetVal

End Function