使用Tcl AES包加密备份文件:是否需IV及大文件加密可行性咨询
关于Tcl AES加密备份的疑问
我打算编写一个Tcl脚本,将开发文件整合到SQLite数据库文件中,每晚加密后存储到共享主机作为异地备份。目前使用Tcl的AES包,有几个疑问需要确认:
- AES是否适合我这个场景?我要加密的总数据量约10MB,测试单个1.3MB的脚本时,加密耗时14秒、解密耗时51秒,我不关心耗时,只关注安全性。
- 是否需要使用初始化向量(IV)?之前看到一个案例加密密码时没有用IV,称IV用于“大规模流式加密”,但我不确定10MB级别的文件是否需要。
- 出于好奇,如果尝试加密20GB的SQLite文件,是否可行?会不会损坏我的台式机?解密1.3MB文件时,台式机风扇运转明显。
附测试代码:
package require aes set fp [open {UI.js} r] set key "abcd1234dcba4321"; # 16 bytes chan puts stdout "Commenced encryption at [set ts [clock seconds]]" set encrypted [aes::aes -dir encrypt -key $key [read $fp]] chan puts stdout "Completed encryption at [expr {[clock seconds] - $ts}]" chan puts stdout "Commenced decryption at [set ts [clock seconds]]" set decrypted [aes::aes -dir decrypt -key $key $encrypted] chan puts stdout "decrypted: $decrypted" chan puts stdout "Completed decryption at [expr {[clock seconds] - $ts}]"
测试运行结果:
Commenced encryption at 1740380724 Completed encryption at 14 Commenced decryption at 1740380738 Completed decryption at 51
内容的提问来源于stack exchange,提问作者Gary
相关产品推荐
相关产品推荐

