Re: Decrypt from INI file
Besides other issues Text2 = Split(text) means that text will splited on a " " (space) character - so are you sure there are spaces in the text argument ???
Re: Decrypt from INI file
Hi,
I assume that the passed argument: text is filled with space delimited numbers. If that is the case I also assume that they are greater than 18 to avoid having a negative result which Chr$() can't convert to a character.
You could try something like this:
VB Code:
If Val(Text2(i)) >= 18 Then
text = text & Chr(Sqr((Val(Text2(i)) - 18) / (i + 3)))
Else
text = text & "" 'unknown number to decrypt
End If
Have a good one!
BK
Re: Decrypt from INI file
Quote:
Originally Posted by RhinoBull
Besides other issues Text2 = Split(text) means that text will splited on a " " (space) character - so are you sure there are spaces in the text argument ???
YES, i am sure...
Quote:
Originally Posted by Black__Knight
Hi,
I assume that the passed argument: text is filled with space delimited numbers. If that is the case I also assume that they are greater than 18 to avoid having a negative result which Chr$() can't convert to a character.
You could try something like this:
VB Code:
If Val(Text2(i)) >= 18 Then
text = text & Chr(Sqr((Val(Text2(i)) - 18) / (i + 3)))
Else
text = text & "" 'unknown number to decrypt
End If
Have a good one!
BK
Well, this doesn't work... it says tht "Text2" has a problem of some kind... :eek2:
and this is supposed to decrypt a coding from an INI file...
Re: Decrypt from INI file
Post the code that you are using to encrypt the data. Is it a string, or is it numeric data? It's hard to tell from looking at the code.
Re: Decrypt from INI file
to encrypt:
VB Code:
Public Function Encrypt(text As String)
Dim Text2 As String
Text2 = ""
For i = 1 To Len(text)
Text2 = Text2 & " " & Asc(Mid(text, i, 1)) * (i + 3) * Asc(Mid(text, i, 1)) + 18
Next i
Encrypt = Text2
End Function