I'm working with an Attachmate (MicroFocus) Extra! Basic macro and have a need to encode a string to Base64 for rudimentary password protection. The code below is what keeps popping up in searches. I'm not sure if I'm missing a declaration or lib, but I'm stuck on this issue. Can anyone point me in the right direction to Encode Base64 in Extra! Basic, or any other simple hash.
Function EncodeBase64(text$)
Dim b
With CreateObject("ADODB.Stream")
.Open: .Type = 2: .Charset = "utf-8"
.WriteText text: .Position = 0: .Type = 1: b = .Read
With CreateObject("Microsoft.XMLDOM").createElement("b64")
.DataType = "bin.base64": .nodeTypedValue = b
' EncodeBase64 = Replace(Mid(.text, 5), vbLf, "")
End With
.Close
End With
End Function