Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sm4中的IV为什么不需要随机生成? #102

Closed
tututt opened this issue Mar 8, 2021 · 8 comments
Closed

sm4中的IV为什么不需要随机生成? #102

tututt opened this issue Mar 8, 2021 · 8 comments

Comments

@tututt
Copy link

tututt commented Mar 8, 2021

No description provided.

@czdsdo
Copy link
Collaborator

czdsdo commented Apr 26, 2021

加密解密时IV值要统一,否则会解密失败。为了使用方法由于就默认取0值了。

@tututt
Copy link
Author

tututt commented Apr 26, 2021

那其实可以外部传入是不是,这样安全性更高

@czdsdo
Copy link
Collaborator

czdsdo commented Apr 26, 2021

是的,由于会多加一个传入参数,考虑到兼容性,与其他库互操作时也没要求自定义IV值,所以就暂时没把IV暴露出来。

@tututt
Copy link
Author

tututt commented Apr 26, 2021

这块有后续的计划吗,因为iv固定的话实际和ECB模式没有差别了

@czdsdo
Copy link
Collaborator

czdsdo commented Apr 26, 2021

其他模式里的设置的IV值会影响到第一次分组的结果,后续分组操作会基于上次操作的结果。IV值的设置与否不会影响各种模式的操作逻辑流程。

@tututt
Copy link
Author

tututt commented Apr 26, 2021

不好意思,是我看差了,确实有影响,后续暴露IV的计划吗?

@czdsdo
Copy link
Collaborator

czdsdo commented Apr 26, 2021

下个版本会暴露, 预计下个月。

@tututt
Copy link
Author

tututt commented Apr 26, 2021

好的,感谢回答,我close了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants