Crypt_RC4

# Procedural File: RC4.php

Source Location: /lib/3rdParty/phpseclib/Crypt/RC4.php

## Classes:

Crypt_RC4
  Pure-PHP implementation of RC4.

## Page Details:

Pure-PHP implementation of RC4.

Uses mcrypt, if available, and an internal implementation, otherwise.

PHP versions 4 and 5

Useful resources are as follows:

- ARCFOUR Algorithm
- - Wikipedia: RC4

RC4 is also known as ARCFOUR or ARC4. The reason is elaborated upon at Wikipedia. This class is named RC4 and not ARCFOUR or ARC4 because RC4 is how it is refered to in the SSH1 specification.

Here's a short example of how to use this library:

1. <?php
2. include('Crypt/RC4.php');
4. $rc4 = new Crypt_RC4 ();
6. $rc4->setKey('abcdefgh');
8. $size = 10 * 1024;
9. $plaintext = '';
10. for ($i = 0; $i < $size; $i++) {
11. $plaintext.= 'a';
12. }
14. echo $rc4->decrypt($rc4->encrypt($plaintext));
15. ?>

LICENSE: This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

#### Tags:

author: | Jim Wigginton <terrafrost@php.net>
version: | $Id: RC4.php,v 1.1 2010/05/14 14:06:16 gruberroland Exp $
copyright: | MMVII Jim Wigginton
link: | http://phpseclib.sourceforge.net
license: | http://www.gnu.org/licenses/lgpl.txt

Documentation generated on Thu, 28 Oct 2010 21:00:31 +0200 by phpDocumentor 1.4.1