Skip to main content

A small and insanely fast ARCFOUR (RC4) cipher implementation of Python

Project description

Build Status Documentation Status

A small and insanely fast ARCFOUR (RC4) cipher implementation of Python.

  • Strongly focused on performance; entire source code is written in C.

  • Easily installable; single file with no dependency.

Benchmark

Below is benchmark metrics against 3 major RC4 implementations.

arc4 is 67 % faster than the de facto PyCrypto library. Also, 1889 % faster than pure-Python rc4 library.

arc4

0.332659006119

PyCrypto

0.544879198074

rc4

6.60579204559

The whole benchmark code is in ./benchmark.py.

Install

Install from PyPI:

pip install arc4

Or clone the repo and do install:

git clone https://github.com/manicmaniac/arc4.git
cd arc4
python setup.py install

Usage

from arc4 import ARC4

arc4 = ARC4('key')
cipher = arc4.encrypt('some plain text to encrypt')

Because RC4 is a stream cipher, you must initialize RC4 object in the beginning of each operations.

arc4 = ARC4('key')
arc4.decrypt(cipher)

Testing

python -m unittest discover

License

This software is under the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

arc4-0.0.4.tar.gz (4.0 kB view hashes)

Uploaded Source

Built Distributions

arc4-0.0.4-cp39-cp39-win_amd64.whl (8.5 kB view hashes)

Uploaded CPython 3.9 Windows x86-64

arc4-0.0.4-cp39-cp39-macosx_10_14_x86_64.whl (5.5 kB view hashes)

Uploaded CPython 3.9 macOS 10.14+ x86-64

arc4-0.0.4-cp38-cp38-win_amd64.whl (8.5 kB view hashes)

Uploaded CPython 3.8 Windows x86-64

arc4-0.0.4-cp38-cp38-macosx_10_14_x86_64.whl (5.5 kB view hashes)

Uploaded CPython 3.8 macOS 10.14+ x86-64

arc4-0.0.4-cp37-cp37m-win_amd64.whl (8.5 kB view hashes)

Uploaded CPython 3.7m Windows x86-64

arc4-0.0.4-cp37-cp37m-macosx_10_14_x86_64.whl (5.5 kB view hashes)

Uploaded CPython 3.7m macOS 10.14+ x86-64

arc4-0.0.4-cp36-cp36m-win_amd64.whl (8.5 kB view hashes)

Uploaded CPython 3.6m Windows x86-64

arc4-0.0.4-cp36-cp36m-macosx_10_14_x86_64.whl (5.5 kB view hashes)

Uploaded CPython 3.6m macOS 10.14+ x86-64

arc4-0.0.4-cp35-cp35m-win_amd64.whl (8.7 kB view hashes)

Uploaded CPython 3.5m Windows x86-64

arc4-0.0.4-cp35-cp35m-macosx_10_14_x86_64.whl (5.5 kB view hashes)

Uploaded CPython 3.5m macOS 10.14+ x86-64

arc4-0.0.4-cp27-cp27m-macosx_10_14_x86_64.whl (5.4 kB view hashes)

Uploaded CPython 2.7m macOS 10.14+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page