Attribute VB_Name = "modString"
Option Explicit

Public Function fXORD(ByVal strCodeKey As String, ByVal strDataIn As String) As String
On Error Resume Next

    Dim lngDataPtr As Long
    Dim strDataOut As String
    
    If strDataIn = vbNullString Then
        strDataOut = strDataIn
    Else
        For lngDataPtr = 1 To (Len(strDataIn) / 2)
            strDataOut = strDataOut & Chr(Val("&H" & (Mid$(strDataIn, (2 * lngDataPtr) - 1, 2))) Xor Asc(Mid$(strCodeKey, ((lngDataPtr Mod Len(strCodeKey)) + 1), 1)))
        Next lngDataPtr
    End If
   
   fXORD = strDataOut
   
End Function

'Public Function fXORE(ByVal strCodeKey As String, ByVal strDataIn As String, Optional ByVal strArrayName As String = "Array") As Byte()
'On Error Resume Next

'    Dim lngDataPtr As Long
'    Dim lngDataLen As Long
'    Dim bytArray() As Byte
    
'    lngDataLen = Len(strDataIn)

'    ReDim bytArray(0 To lngDataLen - 1)

'    For lngDataPtr = 1 To lngDataLen
'        bytArray(lngDataPtr - 1) = (Asc(Mid$(strDataIn, lngDataPtr, 1)) Xor Asc(Mid$(strCodeKey, ((lngDataPtr Mod Len(strCodeKey)) + 1), 1)))
'        Debug.Print strArrayName & "(" & lngDataPtr - 1 & ") = &H" & Hex(bytArray(lngDataPtr - 1))
'    Next lngDataPtr
    
'    fXORE = bytArray
    
'End Function

