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
You can use function
TextBase64:It is a wrapper only. The full code is way too much to post here, but can be found in module
BCrypt.baslocated at my GitHub project VBA.Cryptography including full documentation.Note please, that Base64 encoding in no way protects your passwords. However, the project and the articles detail how to apply full protection using current methods.