rclone-crypt


Namerclone-crypt JSON
Version 1.1.2 PyPI version JSON
download
home_pagehttps://github.com/Ftbom/rclone_crypt_py
SummaryPython implementation of encryption/decryption for rclone (crypt storage)
upload_time2023-11-12 07:17:50
maintainer
docs_urlNone
authorftbom
requires_python>=3.8
licenseMIT
keywords rclone decrypt encrypt
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # rclone_crypt_py

[English](https://github.com/Ftbom/rclone_crypt_py/blob/main/README.md), [简体中文](https://github.com/Ftbom/rclone_crypt_py/blob/main/README-zh.md)

Python implementation of encryption/decryption for rclone (crypt storage)

## Usage

```python
from rclone import Crypt
# Initialize
# Pass in passwd1 and passwd2

# The password here is the password for creating the crypt, not the password in the rclone configuration file
# If passwd2 is not set, the second parameter can be omitted
crypt = Crypt('PvrhK9lOaJMdJO2', 'bjnW66SNkUuV4hX')

# To use passwords directly in the rclone configuration file(obscured password), you should set the passwd_obscured parameter to True.
# crypt = Crypt('SpnX0yEFxpNJjo9bxd3xAlVoXA7F4cr3C0SA-zmfzw', 'ziWH7jKYerB6o5vHnaXAvISTguFD6ZFJFbhT3BlLVQ', True)

# File encryption/decryption
crypt.File.file_decrypt(input_file_path, output_file_path)
crypt.File.file_encrypt(input_file_path, output_file_path)

# File path encryption/decryption
# obfuscate
crypt.Name.obfuscate_encrypt('Hello,Word')
crypt.Name.obfuscate_decrypt('188.Nkrru,cuxj')

#standard
crypt.Name.standard_encrypt('Hello,Word/你好,世界')
crypt.Name.standard_decrypt('tj0ivgsmd9vh4ccfov7f739in0/lb8g1ak1849smj6mlmpv2c5aio')
```

```python
from rclone import Crypt
crypt = Crypt('PvrhK9lOaJMdJO2', 'bjnW66SNkUuV4hX')

# bytes decryption
with open('test.bin', 'rb') as f:
    f.seek(8) # Skip the fixed file header b'RCLONE\x00\x00'
    init_nonce = f.read(24) # Read the nonce
    f.seek(5 * (1024 * 64 + 16), 1) # Skip 5 data blocks
    input_bytes = f.read(10 * (1024 * 64 + 16)) # Read 10 data blocks
    output_bytes = crypt.File.bytes_decrypt(input_bytes, init_nonce, 5) # Decrypt the data blocks

# bytes encryption
import nacl
with open('test.bin', 'wb') as f:
    f.write(b'RCLONE\x00\x00') # Write the standard header
    init_nonce = nacl.utils.random(24) # Generate a random nonce (24 bits)
    f.write(init_nonce) # Write the nonce
    with open('origin.bin', 'rb') as fl:
        origin_bytes = fl.read(1024 * 64 * 10) # Read 10 data blocks
        i = 0
        while origin_bytes:
            f.write(crypt.File.bytes_encrypt(origin_bytes, init_nonce, i))
            origin_bytes = fl.read(1024 * 64 * 10)
            i = i + 10
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Ftbom/rclone_crypt_py",
    "name": "rclone-crypt",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "rclone,decrypt,encrypt",
    "author": "ftbom",
    "author_email": "lz490070@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/e6/1c/1a34759177ee143814e6e105beae78fe0221d4974afce62ff83da8e06397/rclone-crypt-1.1.2.tar.gz",
    "platform": null,
    "description": "# rclone_crypt_py\n\n[English](https://github.com/Ftbom/rclone_crypt_py/blob/main/README.md), [\u7b80\u4f53\u4e2d\u6587](https://github.com/Ftbom/rclone_crypt_py/blob/main/README-zh.md)\n\nPython implementation of encryption/decryption for rclone (crypt storage)\n\n## Usage\n\n```python\nfrom rclone import Crypt\n# Initialize\n# Pass in passwd1 and passwd2\n\n# The password here is the password for creating the crypt, not the password in the rclone configuration file\n# If passwd2 is not set, the second parameter can be omitted\ncrypt = Crypt('PvrhK9lOaJMdJO2', 'bjnW66SNkUuV4hX')\n\n# To use passwords directly in the rclone configuration file(obscured password), you should set the passwd_obscured parameter to True.\n# crypt = Crypt('SpnX0yEFxpNJjo9bxd3xAlVoXA7F4cr3C0SA-zmfzw', 'ziWH7jKYerB6o5vHnaXAvISTguFD6ZFJFbhT3BlLVQ', True)\n\n# File encryption/decryption\ncrypt.File.file_decrypt(input_file_path, output_file_path)\ncrypt.File.file_encrypt(input_file_path, output_file_path)\n\n# File path encryption/decryption\n# obfuscate\ncrypt.Name.obfuscate_encrypt('Hello,Word')\ncrypt.Name.obfuscate_decrypt('188.Nkrru,cuxj')\n\n#standard\ncrypt.Name.standard_encrypt('Hello,Word/\u4f60\u597d\uff0c\u4e16\u754c')\ncrypt.Name.standard_decrypt('tj0ivgsmd9vh4ccfov7f739in0/lb8g1ak1849smj6mlmpv2c5aio')\n```\n\n```python\nfrom rclone import Crypt\ncrypt = Crypt('PvrhK9lOaJMdJO2', 'bjnW66SNkUuV4hX')\n\n# bytes decryption\nwith open('test.bin', 'rb') as f:\n    f.seek(8) # Skip the fixed file header b'RCLONE\\x00\\x00'\n    init_nonce = f.read(24) # Read the nonce\n    f.seek(5 * (1024 * 64 + 16), 1) # Skip 5 data blocks\n    input_bytes = f.read(10 * (1024 * 64 + 16)) # Read 10 data blocks\n    output_bytes = crypt.File.bytes_decrypt(input_bytes, init_nonce, 5) # Decrypt the data blocks\n\n# bytes encryption\nimport nacl\nwith open('test.bin', 'wb') as f:\n    f.write(b'RCLONE\\x00\\x00') # Write the standard header\n    init_nonce = nacl.utils.random(24) # Generate a random nonce (24 bits)\n    f.write(init_nonce) # Write the nonce\n    with open('origin.bin', 'rb') as fl:\n        origin_bytes = fl.read(1024 * 64 * 10) # Read 10 data blocks\n        i = 0\n        while origin_bytes:\n            f.write(crypt.File.bytes_encrypt(origin_bytes, init_nonce, i))\n            origin_bytes = fl.read(1024 * 64 * 10)\n            i = i + 10\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Python implementation of encryption/decryption for rclone (crypt storage)",
    "version": "1.1.2",
    "project_urls": {
        "Bug Tracker": "https://github.com/Ftbom/rclone_crypt_py/issues",
        "Homepage": "https://github.com/Ftbom/rclone_crypt_py"
    },
    "split_keywords": [
        "rclone",
        "decrypt",
        "encrypt"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "cf455deda8914a0c89878ec6e187fbcce761f975cb32e3eb91de217ebf53bb8d",
                "md5": "1cbfded51cc49cf8b305001675d8febb",
                "sha256": "520b602205c609bba4ec519f855cbe93ecebff5858b6d6412f64c080d662148f"
            },
            "downloads": -1,
            "filename": "rclone_crypt-1.1.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "1cbfded51cc49cf8b305001675d8febb",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 10160,
            "upload_time": "2023-11-12T07:17:49",
            "upload_time_iso_8601": "2023-11-12T07:17:49.552507Z",
            "url": "https://files.pythonhosted.org/packages/cf/45/5deda8914a0c89878ec6e187fbcce761f975cb32e3eb91de217ebf53bb8d/rclone_crypt-1.1.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e61c1a34759177ee143814e6e105beae78fe0221d4974afce62ff83da8e06397",
                "md5": "b6884f9a062573932504e4188fd93168",
                "sha256": "debd0d84f56a0a0cae49cba6f9fc0b6abb1a0821a0539f05a8e1ea670c79d5c8"
            },
            "downloads": -1,
            "filename": "rclone-crypt-1.1.2.tar.gz",
            "has_sig": false,
            "md5_digest": "b6884f9a062573932504e4188fd93168",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 12473,
            "upload_time": "2023-11-12T07:17:50",
            "upload_time_iso_8601": "2023-11-12T07:17:50.862850Z",
            "url": "https://files.pythonhosted.org/packages/e6/1c/1a34759177ee143814e6e105beae78fe0221d4974afce62ff83da8e06397/rclone-crypt-1.1.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-11-12 07:17:50",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Ftbom",
    "github_project": "rclone_crypt_py",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "rclone-crypt"
}
        
Elapsed time: 0.13588s