Python implementation of encryption/decryption for rclone (crypt storage)
Project description
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) # 数据块解密
Project details
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.1.tar.gz
(11.7 kB
view hashes)
Built Distribution
Close
Hashes for rclone_crypt-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cdb0b7113f9b87f7bcd200966c65ad0c0de7a5299439a943d0c0636da81e06bb |
|
MD5 | a07604ee1b01e567adee25d444d1fc90 |
|
BLAKE2b-256 | d43170fcb6f4fcd87c0ffcb8ecc84d5dc3ce78411d5c89cab47a6c595ef0171f |