ValueError: IV must be 16 bytes long问题的解决
来源:互联网 发布:医疗网络咨询案例 编辑:程序博客网 时间:2024/05/16 15:21
今天在学习用python Crypto.Cipher 的AES加密的时候,遇到了这个问题ValueError: IV must be 16 bytes long,折腾很久都没有搞出来,总算看到了一个大神的解答,结果很简单很简单的就可以解决了,解决方法如下:
在这个里边儿 AES.new(self.key, self.mode)加上这样一串字符就可以了,就想这样:
cryptor = AES.new(self.key, self.mode, b'0000000000000000')
加了16个0就把问题解决了哈!
解释是是说python内部缺省的iv长度可能小于16,所以就会出现那个iv长度必须为16的提示,因此就必须明确指出iv。
0 0
- ValueError: IV must be 16 bytes long问题的解决
- Keras VGG16中ValueError: filter must not be larger than the input问题的解决
- python32版本,出现问题“struct.error: argument for 's' must be a bytes object”的解决办法
- tensorflow ValueError: Dimensions must be equal
- ValueError: fill value must be in categories.
- ValueError: Masked arrays must be 1-D
- Python之Headers value 1 must be of type str or bytes, not <class 'int'>错误的解决
- service intent must be explicit:intent问题的解决
- TypeError: must be str, not bytes
- write() argument must be str, not bytes
- TypeError: must be str, not bytes
- ValueError:Cannot assign:A must be a 'B' instance.
- Python Error1: ValueError: range parameter must be finite.
- According to TLD, tag fmt:formatDate must be empty, but is not 问题的解决
- normal block at XXXXXXXX, 16/32 bytes long.的意思
- 保存网页TypeError: must be str, not bytes
- Python中报错TypeError: must be str, not bytes
- TypeError: the JSON object must be str, not 'bytes'
- UML建模之用例图学习笔记
- Struts2中使用ajax+json方式批量删除table数据
- html5shiv让IE6-IE8支持HTML5标签
- Web.xml配置详解
- Pods written in Swift can only be integrated as frameworks
- ValueError: IV must be 16 bytes long问题的解决
- linux终端设备uart驱动分析
- 静态库存在依赖时对程序的影响
- 1013. Battle Over Cities (25)
- Sytem V消息队列(二)
- 微软测试基于云的剪贴板App,可跨平台同步
- gcc的两个选项 -Xlinger -rpath
- Design patterns 设计模式
- Kali linux 安装之后的简单设置