Results 1 to 2 of 2

Thread: VB6 (Custom RC4) To PHP

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2011
    Posts
    1

    VB6 (Custom RC4) To PHP

    I need help to convert this VB function:
    Code:
    Public Function RC4(ByVal Data As String, ByVal Password As String) As String ' This is a Modified RC4 Function ^^
    On Error Resume Next
    Dim F(0 To 255) As Integer, X, Y As Long, Key() As Byte
    Key() = StrConv(Password, vbFromUnicode)
    For X = 0 To 255
        Y = (Y + F(X) + Key(X Mod Len(Password))) Mod 256
        F(X) = X
    Next X
    Key() = StrConv(Data, vbFromUnicode)
    For X = 0 To Len(Data)
        Y = (Y + F(Y) + 1) Mod 256
        Key(X) = Key(X) Xor F(Temp + F((Y + F(Y)) Mod 254))
    Next X
    RC4 = StrConv(Key, vbUnicode)
    End Function
    to PHP function.
    Thank you.

  2. #2
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    Re: VB6 (Custom RC4) To PHP

    The PHP website (www.php.net) has an excellent manual. I would also advise against using the above function because it is not an RC4 implementation (in fact there is a bug in your key scheduling that will result in the same key whatever password you use). The cipher text produced from this would be about as secure as a door made from jelly; I suggest you remove this code from any application you are currently using it in.

    PHP supports a number of recognised encryption libraries (http://uk3.php.net/manual/en/refs.crypto.php). I suggest you use one of these.
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

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