0

I pulled this code for ASP from http://personalsources.com/includes/functions.asp and its encode all password into RC4 , the function of encoding is :

function rc4(byref thestr, byref thekey) dim asciiarray(255) dim keyarray(255) if isnull(thestr) then exit function if len(thekey)=0 then exit function if len(thestr)=0 then thestr=" " if len(thestr)=0 then exit function zxlen=len(thekey) for ipos=0 To 255 keyarray(ipos)=asc(mid(thekey, ((ipos) Mod (zxlen)) + 1, 1)) next for ipos=0 To 255 asciiarray(ipos)=ipos next vpos=0 for ipos=0 To 255 vpos=(vpos + asciiarray(ipos) + keyarray(ipos)) Mod 256 tempa= asciiarray(ipos) asciiarray(ipos)=asciiarray(vpos) asciiarray(vpos)=tempa next ipos=0 vpos=0 for rcx=1 To len(thestr) ipos=(ipos + 1) Mod 256 vpos=(vpos + asciiarray(ipos)) Mod 256 tempb=(asciiarray(ipos) + asciiarray(vpos)) Mod 256 tempa=asciiarray(ipos) asciiarray(ipos)=asciiarray(vpos) asciiarray(vpos)=tempa tempc=asciiarray(tempb) rc4=rc4 & chr(asc(mid(thestr, rcx, 1)) xor tempc) next end function 

you know if we have the key of encryption (RC4) so we can decrypt the password very easily , but i dont know how this function encrypt password ? and what is the exact algorithm of this function ? is this possible to write a function to decrypt this RC4 password ?


for example a encryption password by this function is like this (and its never like RC4 passwords!!!) :

>r²çÅÅ 
1
  • 1
    Thanks Travis , how do u find it ? Commented Apr 13, 2012 at 8:59

3 Answers 3

2

RC4 is a stream cypher, so it uses XOR to encrypt. Running RC4 produces a random looking keystream of bytes.

To encrypt you do:

plaintext XOR keystream -> cyphertext

To decrypt you do:

cyphertext XOR keystream -> plaintext

In both cases the keystream is the same, produced from RC4 using the same key.

Sign up to request clarification or add additional context in comments.

Comments

1

The password isn't encrypted, so you can't decrypt it.

The data is encrypted. To decrypt it, you need the password, and run the same function with the encrypted text and the original password (the one that was used to encrypt it).

Comments

0

According to Wikipedia, all you have to do to decrypt RC4 is run the same function again with the same key.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.