rclone_crypt_py
python实现的针对rclone(crypt storage)的加密/解密
使用
from rclone import Crypt
# 初始化
# 分别传入passwd1和passwd2
# 此处的passwd是创建crypt时的密码,而不是rclone配置文件中的密码
# 若未设置passwd2,可省略第二个参数
crypt = Crypt('PvrhK9lOaJMdJO2', 'bjnW66SNkUuV4hX')
# 若直接传入rclone配置文件中的密码(混淆后的密码),需将passwd_obscured参数设为True
# crypt = Crypt('SpnX0yEFxpNJjo9bxd3xAlVoXA7F4cr3C0SA-zmfzw', 'ziWH7jKYerB6o5vHnaXAvISTguFD6ZFJFbhT3BlLVQ', True)
# 文件加密/解密
crypt.File.file_decrypt(input_file_path, output_file_path)
crypt.File.file_encrypt(input_file_path, output_file_path)
# 文件路径加密/解密
# 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')
# bytes解密
from rclone import Crypt
crypt = Crypt('PvrhK9lOaJMdJO2', 'bjnW66SNkUuV4hX')
with open('D:/Download/test.bin', 'rb') as f:
f.seek(8) # 跳过固定文件头 b'RCLONE\x00\x00'
init_nonce = f.read(24) # 读取nonce
f.seek(5 * (1024 * 64 + 16), 1) # 跳过5个数据块
input_bytes = f.read(10 * (1024 * 64 + 16)) # 读取10个数据块
output_bytes = crypt.File.bytes_decrypt(input_bytes, init_nonce, 5) # 数据块解密
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
rclone-crypt-1.0.0.tar.gz
(11.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rclone-crypt-1.0.0.tar.gz.
File metadata
- Download URL: rclone-crypt-1.0.0.tar.gz
- Upload date:
- Size: 11.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/4.0.2 CPython/3.11.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1bd75b838b6547507f6d0ceb58ed50736f8a429bad8e3c6ee78151b6dfe10d0b
|
|
| MD5 |
cb98ba61b83493fbc8102c05dba832fe
|
|
| BLAKE2b-256 |
d5b4b0c8df4ed57560a1fd0ef26671fb14aec46b03dfaf8007f17222581bd49b
|
File details
Details for the file rclone_crypt-1.0.0-py3-none-any.whl.
File metadata
- Download URL: rclone_crypt-1.0.0-py3-none-any.whl
- Upload date:
- Size: 9.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/4.0.2 CPython/3.11.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f16b6e73dbe27f1129b50c07e222125d88ceaca5baa9e03eef56cb5f06756b51
|
|
| MD5 |
12d45ad6aff2c9d42664cdb54cd1c076
|
|
| BLAKE2b-256 |
e3ab30c8bde12a7bc0b2ca0e57958adcce170525567a2d67ea53fd4079bf169d
|