# pycryp
This is a python library for encryption and decryption of messages. It is designed to be simple and easy to use.
## Installation
```
pip install pycryp
```
## Usage
### Encryption
```python
import pycryp
message = "Hello, World!"
password = "password"
print(pycryp.encrypt(message, password))
#b'gAAAAABl6ym8taGz9n254R0nwIQ2nnMJ19LvgTMItPiTJeJYCeysfIarDwGXZRdyw39iOtPxi91QDRGtGIiLTBgZUEHk1_iTGQ=='
```
It also has an optional parameters for salt, iterations and length of the key. The default values are salt = NULL, iterations = 100000, key_length = 32
Example:
```python
import pycryp
message = "Hello, World!"
password = "password"
salt = b"someSALT" # Must be a byte string
iterations = 100000
key_length = 32
print(pycryp.encrypt(message, password, salt, iterations, key_length))
#gAAAAABl6yoPFjKhjCSJ1cOt68GuYNthZi3Ie9sc7QdMWa0BvaNHGb-mitXhxFNB2kom4vKBGmLcdlN7GCA_0UnGSWOJR_UEUA==
```
### Decryption
```python
import pycryp
encrypted_message = "b'gAAAAABl6ym8taGz9n254R0nwIQ2nnMJ19LvgTMItPiTJeJYCeysfIarDwGXZRdyw39iOtPxi91QDRGtGIiLTBgZUEHk1_iTGQ=='"
password = "password"
print(pycryp.decrypt(encrypted_message, password))
#b'Hello, World!'
```
It also has an optional parameters for salt, iterations and length of the key. The default values are salt = NULL, iterations = 100000, key_length = 32
Example:
```python
import pycryp
encrypted_message = "gAAAAABl6yoPFjKhjCSJ1cOt68GuYNthZi3Ie9sc7QdMWa0BvaNHGb-mitXhxFNB2kom4vKBGmLcdlN7GCA_0UnGSWOJR_UEUA=="
password = "password"
salt = b"someSALT" # Must be a byte string
iterations = 100000
key_length = 32
print(pycryp.decrypt(encrypted_message, password, salt, iterations, key_length))
#b'Hello, World!'
```
### Note:
The salt, iterations and key_length must be the same for both encryption and decryption. If you change the values for encryption, you must also change the values for decryption.
Message and password can be a string or a byte string.
### Generating Password
```python
import pycryp
print(pycryp.generate_password())
#_=?Q.iaA#y$O
```
It also has an optional parameter for length, Upper case, Lower case, Digits and Special characters. The default values are length = 16, upper = True, lower = True, digits = True, special = True
Example:
```python
import pycryp
print(pycryp.generate_password(16, True, True, True, True))
#_=?Q.iaA#y$O
```
### Generating Salt
```python
import pycryp
print(pycryp.generate_salt())
#b'\xeeG\xea\x07\xe2\x01\xd58\xc2\x0f\xd8fK\xdb\xc0\x83'
```
It also has an optional parameter for length. The default value is length = 16
Example:
```python
import pycryp
print(pycryp.generate_salt(16))
#b'\xeeG\xea\x07\xe2\x01\xd58\xc2\x0f\xd8fK\xdb\xc0\x83'
```
## License
This project is licensed under the MIT License - see the [LICENSE](https://github.com/suvanbanerjee/pycryp/blob/main/LICENSE) file for details
Raw data
{
"_id": null,
"home_page": "https://github.com/suvanbanerjee/pycryp",
"name": "pycryp",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.5",
"maintainer_email": null,
"keywords": "python, aes, encryption, decryption, aes-256-cbc",
"author": "Suvan Banerjee",
"author_email": "<banerjeesuvan@gmail.com>",
"download_url": null,
"platform": null,
"description": "\n# pycryp\nThis is a python library for encryption and decryption of messages. It is designed to be simple and easy to use.\n\n## Installation\n```\npip install pycryp\n```\n\n## Usage\n\n### Encryption\n```python\nimport pycryp\nmessage = \"Hello, World!\"\npassword = \"password\"\nprint(pycryp.encrypt(message, password))\n#b'gAAAAABl6ym8taGz9n254R0nwIQ2nnMJ19LvgTMItPiTJeJYCeysfIarDwGXZRdyw39iOtPxi91QDRGtGIiLTBgZUEHk1_iTGQ=='\n```\nIt also has an optional parameters for salt, iterations and length of the key. The default values are salt = NULL, iterations = 100000, key_length = 32\n\nExample:\n```python\nimport pycryp\nmessage = \"Hello, World!\"\npassword = \"password\"\nsalt = b\"someSALT\" # Must be a byte string\niterations = 100000\nkey_length = 32\nprint(pycryp.encrypt(message, password, salt, iterations, key_length))\n#gAAAAABl6yoPFjKhjCSJ1cOt68GuYNthZi3Ie9sc7QdMWa0BvaNHGb-mitXhxFNB2kom4vKBGmLcdlN7GCA_0UnGSWOJR_UEUA==\n```\n\n### Decryption\n```python\nimport pycryp\nencrypted_message = \"b'gAAAAABl6ym8taGz9n254R0nwIQ2nnMJ19LvgTMItPiTJeJYCeysfIarDwGXZRdyw39iOtPxi91QDRGtGIiLTBgZUEHk1_iTGQ=='\"\npassword = \"password\"\nprint(pycryp.decrypt(encrypted_message, password))\n#b'Hello, World!'\n```\nIt also has an optional parameters for salt, iterations and length of the key. The default values are salt = NULL, iterations = 100000, key_length = 32\n\nExample:\n```python\nimport pycryp\nencrypted_message = \"gAAAAABl6yoPFjKhjCSJ1cOt68GuYNthZi3Ie9sc7QdMWa0BvaNHGb-mitXhxFNB2kom4vKBGmLcdlN7GCA_0UnGSWOJR_UEUA==\"\npassword = \"password\"\nsalt = b\"someSALT\" # Must be a byte string\niterations = 100000\nkey_length = 32\nprint(pycryp.decrypt(encrypted_message, password, salt, iterations, key_length))\n#b'Hello, World!'\n```\n\n### Note:\n The salt, iterations and key_length must be the same for both encryption and decryption. If you change the values for encryption, you must also change the values for decryption.\n\n Message and password can be a string or a byte string. \n\n### Generating Password\n```python\nimport pycryp\nprint(pycryp.generate_password())\n#_=?Q.iaA#y$O\n```\nIt also has an optional parameter for length, Upper case, Lower case, Digits and Special characters. The default values are length = 16, upper = True, lower = True, digits = True, special = True\n\nExample:\n```python\nimport pycryp\nprint(pycryp.generate_password(16, True, True, True, True))\n#_=?Q.iaA#y$O\n``` \n\n### Generating Salt\n```python\nimport pycryp\nprint(pycryp.generate_salt())\n#b'\\xeeG\\xea\\x07\\xe2\\x01\\xd58\\xc2\\x0f\\xd8fK\\xdb\\xc0\\x83'\n```\nIt also has an optional parameter for length. The default value is length = 16\n\nExample:\n```python\nimport pycryp\nprint(pycryp.generate_salt(16))\n#b'\\xeeG\\xea\\x07\\xe2\\x01\\xd58\\xc2\\x0f\\xd8fK\\xdb\\xc0\\x83'\n```\n\n## License\nThis project is licensed under the MIT License - see the [LICENSE](https://github.com/suvanbanerjee/pycryp/blob/main/LICENSE) file for details\n",
"bugtrack_url": null,
"license": null,
"summary": "package to encrypt and decrypt messages",
"version": "0.2.1",
"project_urls": {
"Homepage": "https://github.com/suvanbanerjee/pycryp"
},
"split_keywords": [
"python",
" aes",
" encryption",
" decryption",
" aes-256-cbc"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "849c811e37e5d7bf650a26539af43dec8d256f18ccfd4db347b6ab5c6d2dc995",
"md5": "50d31de899c466c19f7e9bf63f2a78f8",
"sha256": "7ac1bfd05862a93ced6966417032ca70dea79055c1b7d9ca6d6e3f87c63ea8fd"
},
"downloads": -1,
"filename": "pycryp-0.2.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "50d31de899c466c19f7e9bf63f2a78f8",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.5",
"size": 10526,
"upload_time": "2024-03-30T05:26:22",
"upload_time_iso_8601": "2024-03-30T05:26:22.864867Z",
"url": "https://files.pythonhosted.org/packages/84/9c/811e37e5d7bf650a26539af43dec8d256f18ccfd4db347b6ab5c6d2dc995/pycryp-0.2.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-03-30 05:26:22",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "suvanbanerjee",
"github_project": "pycryp",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "pycryp"
}