Crypto Commands


Encryption/Decryption

RC4

The RC4 is a stream cipher made by Ron Rivest, which is used in TLS and WEP. Because RC4 is an symmetric crypto algorithm both encryption and decryption commands are same.

The following is the methods of encryption and decryption in PHPoC.

This command is for initializing PHPoC's RC4 crypto engine. So this command should be executed before the encryption/decryption. This command returns a context which is used for encryption and decryption operation.

Parameter Description
$rc4_key key for the RC4


The RC4 encryption or decryption is performed with this command. It returns the data which was encrypted or decrypted.

Parameter Description
$rc4 the context when the crypto engine was initialized
$rc4_text plain text to be encrypted or cipher text to be decrypted


This command skips encryption or decryption operation. The skipping operation should be performed to improve the weakness of the RC4.

Parameter Description
$rc4 the context when the crypto engine was initialized

The following is an example of the RC4 encryption and decryption.

// encryption
$rc4 = system("rc4 init %1", $rc4_key);  // initialize
$out = system("rc4 crypt %1 %2", $rc4, $rc4_pt);  // encryption

// decryption test
$rc4 = system("rc4 init %1", $rc4_key);  // initialize
$out = system("rc4 crypt %1 %2", $rc4, $rc4_ct);  // decryption