An open API service indexing awesome lists of open source software.

https://github.com/mauricelambert/rc4encryption

This package implements RC4 encryption.
https://github.com/mauricelambert/rc4encryption

cipher encryption pypi-package python3 rc4 rc4-encryption

Last synced: about 2 months ago
JSON representation

This package implements RC4 encryption.

Awesome Lists containing this project

README

        

![RC4Encryption logo](https://mauricelambert.github.io/info/python/security/RC4Encryption_small.png "RC4Encryption logo")

# RC4Encryption

## Description

This package implements the RC4 encryption.

## Requirements

This package require:

- python3
- python3 Standard Library

## Installation

```bash
pip install RC4Encryption
```

## Usages

### Recommended options

```bash
rc4 [key] -6 -o [secrets.cipher] -i [secrets.file] # encryption
rc4 [key] -n base64 -i [secrets.cipher] -o [decipher.file] -d # decryption
```

### Command line

#### Module

```bash
python3 -m RC4Encryption rc4key -s secrets
```

#### Python executable

```bash
python3 RC4Encryption.pyz rc4key -s secrets
```

#### Command

##### Basic

```bash
rc4 rc4key -s secrets # encrypt "secrets" with rc4key sha256 as key
```

##### Advanced

```bash
rc4 rc4key -s secrets # encrypt "secrets" with rc4key as key
echo secrets| rc4 rc4key --no-sha256 -i # encrypt "secrets\n" with sha256 of rc4key as key
rc4 rc4key -i secrets.txt # encrypt secrets.txt file with rc4key as key
rc4 rc4key -o encrypt.rc4 -s secrets # encrypt "secrets" with rc4key as key and redirect the output to the encrypt.rc4 file
rc4 rc4key -i encrypt.rc4 -d # decrypt encrypt.rc4 with rc4key as key

## INPUT ENCODING

rc4 rc4key -n base64 -s c2VjcmV0cw== # encrypt "secrets" with rc4key sha256 as key ("c2VjcmV0cw==" = base64("secrets"))

## OUTPUT ENCODING

rc4 rc4key -s secrets -8 # encrypt "secrets" with rc4key sha256 as key, base85-encoded output
rc4 rc4key -s secrets -6 # encrypt "secrets" with rc4key sha256 as key, base64-encoded output
rc4 rc4key -s secrets -3 # encrypt "secrets" with rc4key sha256 as key, base30-encoded output
rc4 rc4key -s secrets -1 # encrypt "secrets" with rc4key sha256 as key, base16-encoded output
rc4 rc4key -s secrets -u # encrypt "secrets" with rc4key sha256 as key, uu-encoded output
```

### Python script

```python
from RC4Encryption import RC4Encryption

rc4 = RC4Encryption(b'key')
rc4.make_key()
cipher = rc4.crypt(b'secrets')
cipher_continuation = rc4.crypt(b'secrets')

rc4.reset(b'key')
rc4.make_key()
decipher = rc4.crypt(cipher)
decipher_continuation = rc4.crypt(cipher_continuation)
```

## Links

- [Github Page](https://github.com/mauricelambert/RC4Encryption/)
- [Documentation](https://mauricelambert.github.io/info/python/security/RC4Encryption.html)
- [Pypi package](https://pypi.org/project/RC4Encryption/)
- [Executable](https://mauricelambert.github.io/info/python/security/RC4Encryption.pyz)

## Help

```text
usage: RC4.py [-h] (--input-file [INPUT_FILE] | --input-string INPUT_STRING) [--output-file OUTPUT_FILE]
[--base85 | --base64 | --base32 | --base16 | --output-encoding {base64,base85,base16,base32}]
[--input-encoding {base64,base85,base16,base32}] [--sha256]
key

This file performs RC4 encryption.

positional arguments:
key Encryption key.

options:
-h, --help show this help message and exit
--input-file [INPUT_FILE], --i-file [INPUT_FILE], -i [INPUT_FILE]
The secrets file to be encrypted.
--input-string INPUT_STRING, --string INPUT_STRING, -s INPUT_STRING
The string to be encrypted.
--output-file OUTPUT_FILE, --o-file OUTPUT_FILE, -o OUTPUT_FILE
The output file.
--base85, --85, -8 Base85 encoding as output format
--base64, --64, -6 Base64 encoding as output format
--base32, --32, -3 Base32 encoding as output format
--base16, --16, -1 Base16 encoding as output format
--output-encoding {base64,base85,base16,base32}, --o-encoding {base64,base85,base16,base32}, -e {base64,base85,base16,base32}
Output encoding.
--input-encoding {base64,base85,base16,base32}, --i-encoding {base64,base85,base16,base32}, -n {base64,base85,base16,base32}
Input encoding.
--sha256 Use the sha256 of the key as the key.
```

## Licence

Licensed under the [GPL, version 3](https://www.gnu.org/licenses/).