I have resolved the problem. I’ll post the solution here in case anyone else runs into this issue.
The problem: When encrypting large strings (1 million or more characters), encryption was very slow in VB6 environment. I was attempting to use some of the file encyption methods to work around this problem, but I found a better way.
The solution: The problem was in the BinaryToHex function provided in one of the sample apps. String operations in VB6 are hellishly slow, and concantenating 1 million plus characters was bringing the process to a standstill. I rewrote the function as follows, and it’s now much faster:
Private Function BinaryToHex(ByRef vaBinaryValue As Variant) As String Dim i As Long Dim buffer() As String
ReDim buffer(LenB(vaBinaryValue) – 1)
If (VarType(vaBinaryValue) And vbArray) = vbArray Then For i = 0 To LenB(vaBinaryValue) – 1 buffer(i) = (Right(“0” & Hex(CLng(vaBinaryValue(i))), 2)) Next i End If
BinaryToHex = Join(buffer, “”)
Hope that helps someone else out there someday.
Imported from legacy forums. Posted by David (had 7921 views)