V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
AnyThingElae
V2EX  ›  Python

如何快速的加密很大的 excel 文件

  •  
  •   AnyThingElae · 2021-12-20 17:55:40 +08:00 · 2667 次点击
    这是一个创建于 830 天前的主题,其中的信息可能已经有所发展或是发生改变。

    尝试过使用 python 的 win32com 进行加密,文件小的情况下没问题,文件一大就卡住了

    代码如下

    xcl = win32com.client.DispatchEx('Excel.Application')
    xcl.DisplayAlerts = False
    wb = xcl.workbooks.open(decrypt_excel_path, False, False, None)
    
    wb.SaveAs(encrypt_excel_path, None, excel_key, '')
    
    第 1 条附言  ·  2021-12-21 16:23:17 +08:00
    找到了个不错的加密库,速度不错 herumi/msoffice
    12 条回复    2021-12-22 09:44:53 +08:00
    kokutou
        1
    kokutou  
       2021-12-20 18:05:56 +08:00 via Android   ❤️ 1
    xit 搞 64 位,装固态上,别装任何其他软件,就一个 excel ,然后 excel 文件丢固态上
    再运行脚本试试。。。
    AnyThingElae
        2
    AnyThingElae  
    OP
       2021-12-20 18:23:05 +08:00
    @kokutou 感谢
    xchaoinfo
        3
    xchaoinfo  
       2021-12-21 09:26:57 +08:00   ❤️ 1
    用这个库 msoffcrypto-tool
    xingshu1990
        4
    xingshu1990  
       2021-12-21 10:00:06 +08:00
    @xchaoinfo 精灵球!
    llsquaer
        5
    llsquaer  
       2021-12-21 11:15:38 +08:00
    想到一个自己写的加密...将文件从开始 (自定义字节数),做一个位移运算,(或者移位到后面去..) 管你多大的文件,微秒级加密..当然.只是系统打不开而已...没研究过二进制的搞不明白..... python 用 < > 这 2 个符号就搞定的事情.
    AnyThingElae
        6
    AnyThingElae  
    OP
       2021-12-21 11:31:07 +08:00
    @xchaoinfo 谢谢,我试试哈
    echoechoin
        7
    echoechoin  
       2021-12-21 11:47:05 +08:00
    openssl aes 加密?
    SmiteChow
        8
    SmiteChow  
       2021-12-21 15:44:21 +08:00
    还需要写代码? zip 加密码不行吗?
    AnyThingElae
        9
    AnyThingElae  
    OP
       2021-12-21 16:23:33 +08:00
    @SmiteChow 需求是这样的
    SmiteChow
        10
    SmiteChow  
       2021-12-21 18:02:45 +08:00
    @AnyThingElae 命令行操作呀 `zip -P password test.zip test.txt`
    AnyThingElae
        11
    AnyThingElae  
    OP
       2021-12-21 18:11:26 +08:00
    @SmiteChow 嗯。目前需求是打开 excel 文件需要密码。。打包不符合需求,所以现在用 herumi/msoffice 来加密了
    SmiteChow
        12
    SmiteChow  
       2021-12-22 09:44:53 +08:00
    @AnyThingElae 你的这个实现恐怕得专门定制解密工具才行吧,意味着文件传播出去别人知道密码也不能打开。zip 格式在所有平台都自带客户端能解密,要是纠结压缩这个词语,可以把文件后缀带上,比如 test.txt.zip 。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2412 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 15:59 · PVG 23:59 · LAX 08:59 · JFK 11:59
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.