[AccessD] New Wheel Encryption Add-in

Shamil Salakhetdinov shamil at users.mns.ru
Tue Nov 1 12:24:03 CST 2005


Gustav and Drew,

The code below with 10^5 chars string concatenation works within 1 second.
10^6 chars string concatenation works for ~10 secs on my PC.
So before diving into C++ maybe some easy tricks on VB6/VBA can be used if
they are good enough for a certain task?
Please take into account that sample code below is just for demostation
purposes - it wasn't made "rock solid" as it should be....

' TEST code
Private Sub Command1_Click()
Dim obj As New CStringConcatenator
Dim strTemp As String
Dim strTemp2 As String
Dim i As Long
Dim dtStart As Date
strTemp = String(100000, "A")
strTemp2 = ""
dtStart = Now
For i = 1 To Len(strTemp)
    'strTemp2 = strTemp2 & LCase(Mid(strTemp, i, 1))
    obj.Add LCase(Mid(strTemp, i, 1))
Next i
MsgBox Format(Now - dtStart, "HH:NN:SS")
strTemp2 = obj.Result
MsgBox strTemp2
End Sub

' ===  cut here ====
' Little tricky sample class to concat strings written by SS
Private Const mcstrClassName As String = "CStringConcatenator"

Private fileNumber As Integer
Private fileFullPath As String

Private Sub Class_Initialize()
    fileNumber = FreeFile
    fileFullPath = App.Path & "\~concat.tmp.txt"
    If Len(Dir(fileFullPath, vbNormal)) > 0 Then Kill fileFullPath
    Open fileFullPath For Binary Access Read Write As #fileNumber
End Sub

Private Sub Class_Terminate()
    Close #fileNumber
End Sub

Public Sub Add(ByVal vstr As String)
    Put #fileNumber, , vstr
End Sub

Public Property Get Result() As String
Dim lngFileLen As Long
Dim strResult As String
    lngFileLen = LOF(fileNumber)
    strResult = String(lngFileLen, Chr(0))
    Seek #fileNumber, 1
    Get #fileNumber, , strResult
    Result = strResult
End Property

HTH,
Shamil

----- Original Message ----- 
From: "Gustav Brock" <Gustav at cactus.dk>
To: <accessd at databaseadvisors.com>
Sent: Tuesday, November 01, 2005 4:49 PM
Subject: Re: [AccessD] New Wheel Encryption Add-in


> Hi Drew
>
> Well, one thread to check out, is:
>
>   Array faster in DLL?
>
> That could really spin up your wheel encryption ...
>
> /gustav
>
> >>> DWUTKA at marlow.com 01-11-2005 14:32 >>>
> Sorry, haven't paid a lot of attention to AccessD lately.  Just been busy.
>
>
> -- 
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com




More information about the AccessD mailing list