|
-
Jun 20th, 2005, 06:42 PM
#1
Thread Starter
Lively Member
Decrypt from INI file
what's wrong with the following:
VB Code:
Public Function Decrypt(text As String)
Dim Text2
Text2 = Split(text)
text = ""
For i = 1 To UBound(Text2)
text = text & Chr(Sqr((Text2(i) - 18) / (i + 3)))
Next i
Decrypt = text
End Function
It says tht line 6 has a problem... but the thing is, tht it worked before.. and now it doesn't...
-
Jun 20th, 2005, 06:54 PM
#2
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 ???
-
Jun 20th, 2005, 06:59 PM
#3
Addicted Member
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
-
Jun 21st, 2005, 04:19 PM
#4
Thread Starter
Lively Member
Re: Decrypt from INI file
 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...
 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...
and this is supposed to decrypt a coding from an INI file...
-
Jun 21st, 2005, 04:54 PM
#5
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.
-
Jun 21st, 2005, 05:01 PM
#6
Thread Starter
Lively Member
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|