<?php
$text = 'hello';
$key = 'test';
echo bin2hex(mcrypt_encrypt(MCRYPT_ARCFOUR, $key, $text, MCRYPT_MODE_STREAM, ''));
echo "\n";
echo bin2hex(mcrypt_decrypt(MCRYPT_ARCFOUR, $key, $text, MCRYPT_MODE_STREAM, ''));
$encrypted = hex2bin('c6ea4b7d8f');
echo "\n";
echo mcrypt_encrypt(MCRYPT_ARCFOUR, $key, $encrypted, MCRYPT_MODE_STREAM, '');
echo "\n";
echo mcrypt_decrypt(MCRYPT_ARCFOUR, $key, $encrypted, MCRYPT_MODE_STREAM, '');
/* --- using OpenSSL --- */
echo "\n";
echo bin2hex(openssl_encrypt($text, 'RC4', pack('H*', $key), OPENSSL_ZERO_PADDING | OPENSSL_RAW_DATA));
preferences:
49.19 ms | 406 KiB | 5 Q