ironfelix717
Registered User.
- Local time
- Today, 10:41
- Joined
- Sep 20, 2019
- Messages
- 193
Hello,
This is getting frustrating at the cost of many hours of production.
A project i am working on is throwing a compile error on the line:
This is true for a few "MID" functions in this project that are entirely unrelated to one another and some instances where the parent function is completely unused. This started randomly last night. The function that contains the line above was introduced to the project (its an RC4 Encryption Alg) AFTER i had to ditch a previous encryption function that was completely different but still used a "MID$" function within. I ditched the first function because rather than scratch my head at it, i would just try a new function i had. Please note this function (as well as the previous i used) has compiled and executed fine several hundred times before.
The compiler raises "Type declaration character does not match declared data type".
I have tried running the VBA decompiler tool on the project multiple times.
CODE :
This is getting frustrating at the cost of many hours of production.
A project i am working on is throwing a compile error on the line:
Code:
baK(lIdx) = asc(Mid$(sKey, 1 + (lIdx Mod Len(sKey)), 1))
This is true for a few "MID" functions in this project that are entirely unrelated to one another and some instances where the parent function is completely unused. This started randomly last night. The function that contains the line above was introduced to the project (its an RC4 Encryption Alg) AFTER i had to ditch a previous encryption function that was completely different but still used a "MID$" function within. I ditched the first function because rather than scratch my head at it, i would just try a new function i had. Please note this function (as well as the previous i used) has compiled and executed fine several hundred times before.
The compiler raises "Type declaration character does not match declared data type".
I have tried running the VBA decompiler tool on the project multiple times.
CODE :
Code:
Public Function EncryptRC4(sText As String, sKey As String) As String
Dim baS(0 To 255) As Byte
Dim baK(0 To 255) As Byte
Dim bytSwap As Byte
Dim lI As Long
Dim lJ As Long
Dim lIdx As Long
For lIdx = 0 To 255
baS(lIdx) = lIdx
baK(lIdx) = asc(Mid$(sKey, 1 + (lIdx Mod Len(sKey)), 1))
Next
For lI = 0 To 255
lJ = (lJ + baS(lI) + baK(lI)) Mod 256
bytSwap = baS(lI)
baS(lI) = baS(lJ)
baS(lJ) = bytSwap
Next
lI = 0
lJ = 0
For lIdx = 1 To Len(sText)
lI = (lI + 1) Mod 256
lJ = (lJ + baS(lI)) Mod 256
bytSwap = baS(lI)
baS(lI) = baS(lJ)
baS(lJ) = bytSwap
EncryptRC4 = EncryptRC4 & Chr$((pvCryptXor(baS((CLng(baS(lI)) + baS(lJ)) Mod 256), asc(Mid$(sText, lIdx, 1)))))
Next
End Function