Results 1 to 6 of 6

Thread: Decrypt from INI file

  1. #1

    Thread Starter
    Lively Member smart_phil_dude1's Avatar
    Join Date
    Jun 2005
    Location
    Behind You!
    Posts
    125

    Unhappy Decrypt from INI file

    what's wrong with the following:
    VB Code:
    1. Public Function Decrypt(text As String)
    2. Dim Text2
    3. Text2 = Split(text)
    4. text = ""
    5. For i = 1 To UBound(Text2)
    6.     text = text & Chr(Sqr((Text2(i) - 18) / (i + 3)))
    7. Next i
    8. Decrypt = text
    9. End Function

    It says tht line 6 has a problem... but the thing is, tht it worked before.. and now it doesn't...
    Please Help Us Save Ana or donate now by going to Oneana.com

    Visit my Website at http://www.therealfantasy.com

  2. #2
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    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 ???

  3. #3
    Addicted Member
    Join Date
    May 2005
    Posts
    168

    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:
    1. If Val(Text2(i)) >= 18 Then
    2.         text = text & Chr(Sqr((Val(Text2(i)) - 18) / (i + 3)))
    3.     Else
    4.         text = text & ""  'unknown number to decrypt
    5. End If

    Have a good one!
    BK

  4. #4

    Thread Starter
    Lively Member smart_phil_dude1's Avatar
    Join Date
    Jun 2005
    Location
    Behind You!
    Posts
    125

    Arrow 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:
    1. If Val(Text2(i)) >= 18 Then
    2.         text = text & Chr(Sqr((Val(Text2(i)) - 18) / (i + 3)))
    3.     Else
    4.         text = text & ""  'unknown number to decrypt
    5. 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...
    Please Help Us Save Ana or donate now by going to Oneana.com

    Visit my Website at http://www.therealfantasy.com

  5. #5
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    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.

  6. #6

    Thread Starter
    Lively Member smart_phil_dude1's Avatar
    Join Date
    Jun 2005
    Location
    Behind You!
    Posts
    125

    Re: Decrypt from INI file

    to encrypt:
    VB Code:
    1. Public Function Encrypt(text As String)
    2. Dim Text2 As String
    3. Text2 = ""
    4. For i = 1 To Len(text)
    5.     Text2 = Text2 & " " & Asc(Mid(text, i, 1)) * (i + 3) * Asc(Mid(text, i, 1)) + 18
    6. Next i
    7. Encrypt = Text2
    8. End Function
    Please Help Us Save Ana or donate now by going to Oneana.com

    Visit my Website at http://www.therealfantasy.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width