RC6Encryption


NameRC6Encryption JSON
Version 1.0.0 PyPI version JSON
download
home_pagehttps://github.com/mauricelambert/RC6Encryption
SummaryThis package implements RC6 encryption.
upload_time2024-02-24 14:06:52
maintainerMaurice Lambert
docs_urlNone
authorMaurice Lambert
requires_python>=3.8
licenseGPL-3.0 License
keywords rc6 encryption cipher
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ![RC6Encryption logo](https://mauricelambert.github.io/info/python/security/rc6_small_background.png "RC6Encryption logo")

# RC6Encryption

## Description

This pure python package implements the RC6 encryption (ECB and CBC encryption mode).

> All encryption and decryption mode are tested, i compare the result with https://www.lddgo.net/en/encrypt/rc6 API.
>> The ECB mode is not recommended, it's the basic encryption for block cipher, you should always use CBC encryption for data greater than 16 bytes.

## Requirements

This package require:

 - python3
 - python3 Standard Library

## Installation

```bash
pip install RC6Encryption
```

## Usages

### Recommended options

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

### Command line

#### Module

```bash
python3 -m RC6Encryption rc6key -s secrets
```

#### Python executable

```bash
python3 RC6Encryption.pyz rc6key -s secrets
```

#### Command

##### Basic

```bash
rc6 rc6key -s secrets                               # encrypt "secrets" with rc6key sha256 as key
```

##### Advanced

```bash
rc6 rc6key -r 12 -l 5 -w 32 -s secrets              # encrypt "secrets" with rc6key sha256 as key (rounds=12, wbit=32, lgw=5) in ECB mode
echo secrets| rc6 rc6key --no-sha256 -i             # encrypt "secrets\n" with key and PKCS 5/7 padding in ECB mode
rc6 rc6key -m CBC -I IVTEST -i secrets.txt          # encrypt secrets.txt file content with rc6key sha256 as key and CBC mode and IVTEST as IV
rc6 rc6key -o encrypt.rc6 -s secrets -m CBC         # encrypt "secrets" with rc6key sha256 as key, IVTEST as IV and redirect the output to the encrypt.rc6 file using CBC encryption mode and random IV
rc6 rc6key -i encrypt.rc6 -d -m CBC                 # decrypt encrypt.rc6 with rc6key sha256 as key using CBC encryption mode

## INPUT  ENCODING

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

## OUTPUT ENCODING

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

### Python script

#### RC6 encryption using CBC (recommended)

```python
from RC6Encryption import RC6Encryption

rc6 = RC6Encryption(b'abcdefghijklm')
iv, encrypt = rc6.data_encryption_CBC(b'abcdefghijklmnopabcdefghijklmnopabcdefghijklm')             # Random IV
plaintext = rc6.data_decryption_CBC(encrypt, iv)

iv, encrypt = rc6.data_encryption_CBC(b'abcdefghijklmnopabcdefghijklmnopabcdefghijklm', b'IVTEST')  # Generate your IV, be careful, an IV with size less than 16 bytes is not recommended
plaintext = rc6.data_decryption_CBC(encrypt, iv)
```

#### RC6 encryption using ECB (not recommended)

```python
from RC6Encryption import RC6Encryption

rc6 = RC6Encryption(b'abcdefghijklm')
iv, encrypt = rc6.data_encryption_EBC(b'abcdefghijklmnopabcdefghijklmnopabcdefghijklm')
plaintext = rc6.data_decryption_CBC(encrypt, iv)
```

#### Low level API

```python
from RC6Encryption import RC6Encryption
from hashlib import sha256

rc6 = RC6Encryption(sha256(b'abcdefghijklmnop').digest())
cipher = rc6.blocks_to_data(rc6.encrypt(b'abcdefghijklmnop'))
decipher = rc6.blocks_to_data(rc6.decrypt(cipher))
```

## Links

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

## Help

```text
usage: RC6Encryption.py [-h] [--mode {CBC,ECB}] [--decryption] (--input-file [INPUT_FILE] | --input-string INPUT_STRING) [--output-file OUTPUT_FILE]
                        [--base85 | --base64 | --base32 | --base16 | --output-encoding {base32,base16,base64,base85}]
                        [--input-encoding {base32,base16,base64,base85}] [--rounds ROUNDS] [--w-bit W_BIT] [--iv IV] [--lgw LGW] [--sha256 | --no-sha256]
                        key

This script performs RC6 encryption.

positional arguments:
  key                   Encryption key.

options:
  -h, --help            show this help message and exit
  --mode {CBC,ECB}, -m {CBC,ECB}
                        Ecryption mode, for CBC encryption IV is write on the first 16 bytes of the encrypted data.
  --decryption, -d      Data decryption.
  --input-file [INPUT_FILE], --i-file [INPUT_FILE], -i [INPUT_FILE]
                        The 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 {base32,base16,base64,base85}, --o-encoding {base32,base16,base64,base85}, -e {base32,base16,base64,base85}
                        Output encoding.
  --input-encoding {base32,base16,base64,base85}, --i-encoding {base32,base16,base64,base85}, -n {base32,base16,base64,base85}
                        Input encoding.
  --rounds ROUNDS, -r ROUNDS
                        RC6 rounds
  --w-bit W_BIT, -b W_BIT
                        RC6 w-bit
  --iv IV, -I IV        IV for CBC mode only, for decryption if IV is not set the 16 first bytes are used instead.
  --lgw LGW, -l LGW     RC6 lgw
  --sha256, --no-sha256
                        Use the sha256 hash of the key as the key.
```

## Licence

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

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/mauricelambert/RC6Encryption",
    "name": "RC6Encryption",
    "maintainer": "Maurice Lambert",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "mauricelambert434@gmail.com",
    "keywords": "RC6,Encryption,Cipher",
    "author": "Maurice Lambert",
    "author_email": "mauricelambert434@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/1a/8e/63b161e7ef28e419d1691c6a369600dd379bbc2385c2bf054c3302d2eeef/RC6Encryption-1.0.0.tar.gz",
    "platform": "Windows",
    "description": "![RC6Encryption logo](https://mauricelambert.github.io/info/python/security/rc6_small_background.png \"RC6Encryption logo\")\n\n# RC6Encryption\n\n## Description\n\nThis pure python package implements the RC6 encryption (ECB and CBC encryption mode).\n\n> All encryption and decryption mode are tested, i compare the result with https://www.lddgo.net/en/encrypt/rc6 API.\n>> The ECB mode is not recommended, it's the basic encryption for block cipher, you should always use CBC encryption for data greater than 16 bytes.\n\n## Requirements\n\nThis package require:\n\n - python3\n - python3 Standard Library\n\n## Installation\n\n```bash\npip install RC6Encryption\n```\n\n## Usages\n\n### Recommended options\n\n```bash\nrc6 [key] -m CBC -6 -o [secrets.cipher] -i [secrets.file]            # encryption\nrc6 [key] -m CBC -n base64 -i [secrets.cipher] -o [decipher.file] -d # decryption\n```\n\n### Command line\n\n#### Module\n\n```bash\npython3 -m RC6Encryption rc6key -s secrets\n```\n\n#### Python executable\n\n```bash\npython3 RC6Encryption.pyz rc6key -s secrets\n```\n\n#### Command\n\n##### Basic\n\n```bash\nrc6 rc6key -s secrets                               # encrypt \"secrets\" with rc6key sha256 as key\n```\n\n##### Advanced\n\n```bash\nrc6 rc6key -r 12 -l 5 -w 32 -s secrets              # encrypt \"secrets\" with rc6key sha256 as key (rounds=12, wbit=32, lgw=5) in ECB mode\necho secrets| rc6 rc6key --no-sha256 -i             # encrypt \"secrets\\n\" with key and PKCS 5/7 padding in ECB mode\nrc6 rc6key -m CBC -I IVTEST -i secrets.txt          # encrypt secrets.txt file content with rc6key sha256 as key and CBC mode and IVTEST as IV\nrc6 rc6key -o encrypt.rc6 -s secrets -m CBC         # encrypt \"secrets\" with rc6key sha256 as key, IVTEST as IV and redirect the output to the encrypt.rc6 file using CBC encryption mode and random IV\nrc6 rc6key -i encrypt.rc6 -d -m CBC                 # decrypt encrypt.rc6 with rc6key sha256 as key using CBC encryption mode\n\n## INPUT  ENCODING\n\nrc6 rc6key -n base64 -s c2VjcmV0cw==                # encrypt \"secrets\" with rc6key sha256 as key (\"c2VjcmV0cw==\" = base64(\"secrets\"))\n\n## OUTPUT ENCODING\n\nrc6 rc6key -s secrets -8                            # encrypt \"secrets\" with rc6key sha256 as key, base85-encoded output\nrc6 rc6key -s secrets -6                            # encrypt \"secrets\" with rc6key sha256 as key, base64-encoded output\nrc6 rc6key -s secrets -3                            # encrypt \"secrets\" with rc6key sha256 as key, base30-encoded output\nrc6 rc6key -s secrets -1                            # encrypt \"secrets\" with rc6key sha256 as key, base16-encoded output\nrc6 rc6key -s secrets -u                            # encrypt \"secrets\" with rc6key sha256 as key, uu-encoded output\n```\n\n### Python script\n\n#### RC6 encryption using CBC (recommended)\n\n```python\nfrom RC6Encryption import RC6Encryption\n\nrc6 = RC6Encryption(b'abcdefghijklm')\niv, encrypt = rc6.data_encryption_CBC(b'abcdefghijklmnopabcdefghijklmnopabcdefghijklm')             # Random IV\nplaintext = rc6.data_decryption_CBC(encrypt, iv)\n\niv, encrypt = rc6.data_encryption_CBC(b'abcdefghijklmnopabcdefghijklmnopabcdefghijklm', b'IVTEST')  # Generate your IV, be careful, an IV with size less than 16 bytes is not recommended\nplaintext = rc6.data_decryption_CBC(encrypt, iv)\n```\n\n#### RC6 encryption using ECB (not recommended)\n\n```python\nfrom RC6Encryption import RC6Encryption\n\nrc6 = RC6Encryption(b'abcdefghijklm')\niv, encrypt = rc6.data_encryption_EBC(b'abcdefghijklmnopabcdefghijklmnopabcdefghijklm')\nplaintext = rc6.data_decryption_CBC(encrypt, iv)\n```\n\n#### Low level API\n\n```python\nfrom RC6Encryption import RC6Encryption\nfrom hashlib import sha256\n\nrc6 = RC6Encryption(sha256(b'abcdefghijklmnop').digest())\ncipher = rc6.blocks_to_data(rc6.encrypt(b'abcdefghijklmnop'))\ndecipher = rc6.blocks_to_data(rc6.decrypt(cipher))\n```\n\n## Links\n\n - [Github Page](https://github.com/mauricelambert/RC6Encryption/)\n - [Documentation](https://mauricelambert.github.io/info/python/security/RC6Encryption.html)\n - [Pypi package](https://pypi.org/project/RC6Encryption/)\n - [Executable](https://mauricelambert.github.io/info/python/security/RC6Encryption.pyz)\n\n## Help\n\n```text\nusage: RC6Encryption.py [-h] [--mode {CBC,ECB}] [--decryption] (--input-file [INPUT_FILE] | --input-string INPUT_STRING) [--output-file OUTPUT_FILE]\n                        [--base85 | --base64 | --base32 | --base16 | --output-encoding {base32,base16,base64,base85}]\n                        [--input-encoding {base32,base16,base64,base85}] [--rounds ROUNDS] [--w-bit W_BIT] [--iv IV] [--lgw LGW] [--sha256 | --no-sha256]\n                        key\n\nThis script performs RC6 encryption.\n\npositional arguments:\n  key                   Encryption key.\n\noptions:\n  -h, --help            show this help message and exit\n  --mode {CBC,ECB}, -m {CBC,ECB}\n                        Ecryption mode, for CBC encryption IV is write on the first 16 bytes of the encrypted data.\n  --decryption, -d      Data decryption.\n  --input-file [INPUT_FILE], --i-file [INPUT_FILE], -i [INPUT_FILE]\n                        The file to be encrypted.\n  --input-string INPUT_STRING, --string INPUT_STRING, -s INPUT_STRING\n                        The string to be encrypted.\n  --output-file OUTPUT_FILE, --o-file OUTPUT_FILE, -o OUTPUT_FILE\n                        The output file.\n  --base85, --85, -8    Base85 encoding as output format\n  --base64, --64, -6    Base64 encoding as output format\n  --base32, --32, -3    Base32 encoding as output format\n  --base16, --16, -1    Base16 encoding as output format\n  --output-encoding {base32,base16,base64,base85}, --o-encoding {base32,base16,base64,base85}, -e {base32,base16,base64,base85}\n                        Output encoding.\n  --input-encoding {base32,base16,base64,base85}, --i-encoding {base32,base16,base64,base85}, -n {base32,base16,base64,base85}\n                        Input encoding.\n  --rounds ROUNDS, -r ROUNDS\n                        RC6 rounds\n  --w-bit W_BIT, -b W_BIT\n                        RC6 w-bit\n  --iv IV, -I IV        IV for CBC mode only, for decryption if IV is not set the 16 first bytes are used instead.\n  --lgw LGW, -l LGW     RC6 lgw\n  --sha256, --no-sha256\n                        Use the sha256 hash of the key as the key.\n```\n\n## Licence\n\nLicensed under the [GPL, version 3](https://www.gnu.org/licenses/).\n",
    "bugtrack_url": null,
    "license": "GPL-3.0 License",
    "summary": "This package implements RC6 encryption.",
    "version": "1.0.0",
    "project_urls": {
        "Documentation": "https://mauricelambert.github.io/info/python/security/RC6Encryption.html",
        "Executable": "https://mauricelambert.github.io/info/python/security/RC6Encryption.pyz",
        "Homepage": "https://github.com/mauricelambert/RC6Encryption"
    },
    "split_keywords": [
        "rc6",
        "encryption",
        "cipher"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1a8e63b161e7ef28e419d1691c6a369600dd379bbc2385c2bf054c3302d2eeef",
                "md5": "f3ba595a9373c1c0ac672e176100816b",
                "sha256": "d046b2fd2a8a9d7114d1cafa0b33edf7d0bb536b12fabbc9955d3adb0e337463"
            },
            "downloads": -1,
            "filename": "RC6Encryption-1.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "f3ba595a9373c1c0ac672e176100816b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 23112,
            "upload_time": "2024-02-24T14:06:52",
            "upload_time_iso_8601": "2024-02-24T14:06:52.106124Z",
            "url": "https://files.pythonhosted.org/packages/1a/8e/63b161e7ef28e419d1691c6a369600dd379bbc2385c2bf054c3302d2eeef/RC6Encryption-1.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-24 14:06:52",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "mauricelambert",
    "github_project": "RC6Encryption",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "rc6encryption"
}
        
Elapsed time: 0.21205s