# KeyCipher
`keycipher` is a Python utility package for encrypting and decrypting text using AES-GCM with a secret key. It provides simple functions to handle secure encryption and decryption.
## Installation
To install the package, use pip:
```bash
pip install keycipher
```
## Usage
Here’s a brief guide on how to use the `keycipher` package.
### Importing the Package
```python
from keycipher import encrypt_data, decrypt_data
```
### Encrypting Data
To encrypt a piece of text, use the `encrypt_data` function. You need to provide the plaintext and a key string.
```python
from keycipher import encrypt_data
key_string = 'your-secret-key' # Replace with your key
plain_text = 'This is a secret message' # Replace with your text
encrypted_data = encrypt_data(plain_text, key_string)
print('Encrypted Data:', encrypted_data)
```
### Decrypting Data
To decrypt data, use the `decrypt_data` function. You need to provide the encrypted data and the same key string used for encryption.
```python
from keycipher import decrypt_data
encrypted_data = {
'iv': '...your IV...',
'cipherText': '...your cipherText...',
'tag': '...your tag...'
} # Replace with your generated encryption object
key_string = 'your-secret-key' # Replace with your key
decrypted_text = decrypt_data(encrypted_data, key_string)
print('Decrypted Text:', decrypted_text)
```
## API
### `encrypt_data(plain_text, key_string)`
Encrypts the given plaintext using the provided key string.
- **Arguments:**
- `plain_text` (str): The text to be encrypted.
- `key_string` (str): The key used for encryption.
- **Returns:** A dictionary containing `iv`, `cipherText`, and `tag`.
### `decrypt_data(encrypted_data, key_string)`
Decrypts the given encrypted data using the provided key string.
- **Arguments:**
- `encrypted_data` (dict): The encrypted data object, which includes `iv`, `cipherText`, and `tag`.
- `key_string` (str): The key used for decryption.
- **Returns:** The decrypted text.
## Example
Here’s a complete example showing both encryption and decryption:
```python
from keycipher import encrypt_data, decrypt_data
# Encryption
key_string = 'your-secret-key'
plain_text = 'This is a secret message'
encrypted_data = encrypt_data(plain_text, key_string)
print('Encrypted Data:', encrypted_data)
# Decryption
decrypted_text = decrypt_data(encrypted_data, key_string)
print('Decrypted Text:', decrypted_text)
```
## About the Author
`keycipher` is created by Parth Dudhatra (imParth), a passionate software engineer, developer advocate, and content creator known for his contributions to the tech community. He is passionate about frontend development, Python programming, open-source software, and sharing knowledge with others.
Parth is active on various social media platforms, where he shares insights, tutorials, and tips related to programming, web development, and software engineering. Parth's dedication to sharing his expertise and fostering a supportive environment for developers has earned him recognition and respect within the tech community. Connect with Parth Dudhatra on social media:
- [Portfolio](https://imparth.me)
- [X/Twitter](https://x.com/imparth73)
- [Instagram](https://instagram.com/imparth.dev)
- [GitHub](https://github.com/imparth7)
- [LinkedIn](https://linkedin.com/in/imparth7)
- [Medium](https://imparth7.medium.com)
- [Dev.to](https://dev.to/imparth)
If you have any questions, feedback, or suggestions, feel free to reach out to me on any platform!
## License
This project is licensed under the ISC License.
## Contributing
Contributions are welcome! Please open an issue or submit a pull request on the [GitHub repository](https://github.com/imparth7/keycipher-py).
## Issues
If you encounter any issues, please report them on the [issues page](https://github.com/imparth7/keycipher-py/issues).
Raw data
{
"_id": null,
"home_page": "https://github.com/imparth7/keycipher-py",
"name": "keycipher",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": "encryption, decryption, AES-GCM, cryptography",
"author": "imparth",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/ef/19/63ef9de1df928737e7b529a118231d72733c6ce506d2c41f116df3e1f947/keycipher-1.0.0.tar.gz",
"platform": null,
"description": "# KeyCipher\r\n\r\n`keycipher` is a Python utility package for encrypting and decrypting text using AES-GCM with a secret key. It provides simple functions to handle secure encryption and decryption.\r\n\r\n## Installation\r\n\r\nTo install the package, use pip:\r\n\r\n```bash\r\npip install keycipher\r\n```\r\n\r\n## Usage\r\n\r\nHere\u00e2\u20ac\u2122s a brief guide on how to use the `keycipher` package.\r\n\r\n### Importing the Package\r\n\r\n```python\r\nfrom keycipher import encrypt_data, decrypt_data\r\n```\r\n\r\n### Encrypting Data\r\n\r\nTo encrypt a piece of text, use the `encrypt_data` function. You need to provide the plaintext and a key string.\r\n\r\n```python\r\nfrom keycipher import encrypt_data\r\n\r\nkey_string = 'your-secret-key' # Replace with your key\r\nplain_text = 'This is a secret message' # Replace with your text\r\n\r\nencrypted_data = encrypt_data(plain_text, key_string)\r\nprint('Encrypted Data:', encrypted_data)\r\n```\r\n\r\n### Decrypting Data\r\n\r\nTo decrypt data, use the `decrypt_data` function. You need to provide the encrypted data and the same key string used for encryption.\r\n\r\n```python\r\nfrom keycipher import decrypt_data\r\n\r\nencrypted_data = {\r\n 'iv': '...your IV...',\r\n 'cipherText': '...your cipherText...',\r\n 'tag': '...your tag...'\r\n} # Replace with your generated encryption object\r\n\r\nkey_string = 'your-secret-key' # Replace with your key\r\n\r\ndecrypted_text = decrypt_data(encrypted_data, key_string)\r\nprint('Decrypted Text:', decrypted_text)\r\n```\r\n\r\n## API\r\n\r\n### `encrypt_data(plain_text, key_string)`\r\n\r\nEncrypts the given plaintext using the provided key string.\r\n\r\n- **Arguments:**\r\n - `plain_text` (str): The text to be encrypted.\r\n - `key_string` (str): The key used for encryption.\r\n\r\n- **Returns:** A dictionary containing `iv`, `cipherText`, and `tag`.\r\n\r\n### `decrypt_data(encrypted_data, key_string)`\r\n\r\nDecrypts the given encrypted data using the provided key string.\r\n\r\n- **Arguments:**\r\n - `encrypted_data` (dict): The encrypted data object, which includes `iv`, `cipherText`, and `tag`.\r\n - `key_string` (str): The key used for decryption.\r\n\r\n- **Returns:** The decrypted text.\r\n\r\n## Example\r\n\r\nHere\u00e2\u20ac\u2122s a complete example showing both encryption and decryption:\r\n\r\n```python\r\nfrom keycipher import encrypt_data, decrypt_data\r\n\r\n# Encryption\r\nkey_string = 'your-secret-key'\r\nplain_text = 'This is a secret message'\r\nencrypted_data = encrypt_data(plain_text, key_string)\r\nprint('Encrypted Data:', encrypted_data)\r\n\r\n# Decryption\r\ndecrypted_text = decrypt_data(encrypted_data, key_string)\r\nprint('Decrypted Text:', decrypted_text)\r\n```\r\n\r\n## About the Author\r\n\r\n`keycipher` is created by Parth Dudhatra (imParth), a passionate software engineer, developer advocate, and content creator known for his contributions to the tech community. He is passionate about frontend development, Python programming, open-source software, and sharing knowledge with others.\r\n\r\nParth is active on various social media platforms, where he shares insights, tutorials, and tips related to programming, web development, and software engineering. Parth's dedication to sharing his expertise and fostering a supportive environment for developers has earned him recognition and respect within the tech community. Connect with Parth Dudhatra on social media:\r\n\r\n- [Portfolio](https://imparth.me)\r\n- [X/Twitter](https://x.com/imparth73)\r\n- [Instagram](https://instagram.com/imparth.dev)\r\n- [GitHub](https://github.com/imparth7)\r\n- [LinkedIn](https://linkedin.com/in/imparth7)\r\n- [Medium](https://imparth7.medium.com)\r\n- [Dev.to](https://dev.to/imparth)\r\n\r\nIf you have any questions, feedback, or suggestions, feel free to reach out to me on any platform!\r\n\r\n## License\r\n\r\nThis project is licensed under the ISC License.\r\n\r\n## Contributing\r\n\r\nContributions are welcome! Please open an issue or submit a pull request on the [GitHub repository](https://github.com/imparth7/keycipher-py).\r\n\r\n## Issues\r\n\r\nIf you encounter any issues, please report them on the [issues page](https://github.com/imparth7/keycipher-py/issues).\r\n",
"bugtrack_url": null,
"license": null,
"summary": "A Python package for AES-GCM encryption and decryption with a key.",
"version": "1.0.0",
"project_urls": {
"Bug Reports": "https://github.com/imparth7/keycipher-py/issues",
"Homepage": "https://github.com/imparth7/keycipher-py#readme",
"Source": "https://github.com/imparth7/keycipher-py"
},
"split_keywords": [
"encryption",
" decryption",
" aes-gcm",
" cryptography"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "54406c238b54c640e1cb6f13222d10907aa4e78df100701e91f9339422871ade",
"md5": "eee0047077b9c539e68a15f6d733d2a7",
"sha256": "e24d6fd241dee88158c1fcfc4f958d9692318badf0ee38c7c75c3f64d6d04cf5"
},
"downloads": -1,
"filename": "keycipher-1.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "eee0047077b9c539e68a15f6d733d2a7",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 3828,
"upload_time": "2024-08-10T06:01:37",
"upload_time_iso_8601": "2024-08-10T06:01:37.667576Z",
"url": "https://files.pythonhosted.org/packages/54/40/6c238b54c640e1cb6f13222d10907aa4e78df100701e91f9339422871ade/keycipher-1.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "ef1963ef9de1df928737e7b529a118231d72733c6ce506d2c41f116df3e1f947",
"md5": "ba35533e611bb20a8977a81488f27bd1",
"sha256": "f0afe4480cae982515c021a861486756dba489c44e14a8c6389b6c237fe19692"
},
"downloads": -1,
"filename": "keycipher-1.0.0.tar.gz",
"has_sig": false,
"md5_digest": "ba35533e611bb20a8977a81488f27bd1",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 3757,
"upload_time": "2024-08-10T06:01:39",
"upload_time_iso_8601": "2024-08-10T06:01:39.140413Z",
"url": "https://files.pythonhosted.org/packages/ef/19/63ef9de1df928737e7b529a118231d72733c6ce506d2c41f116df3e1f947/keycipher-1.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-10 06:01:39",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "imparth7",
"github_project": "keycipher-py",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "keycipher"
}