D0n9X1n / hexo-blog-encrypt

Yet, just another hexo plugin for security.
https://www.npmjs.com/package/hexo-blog-encrypt
MIT License
971 stars 101 forks source link

[Performance] Faster generation of IV #176

Closed ADD-SP closed 2 years ago

ADD-SP commented 2 years ago

https://github.com/D0n9X1n/hexo-blog-encrypt/blob/ad85a05602131f0f9f3febe901900f927576ebd9/index.js#L20 https://github.com/D0n9X1n/hexo-blog-encrypt/blob/ad85a05602131f0f9f3febe901900f927576ebd9/index.js#L93

AES256-CBC only requires that IVs be unpredictable, so I don't see the need to generate IVs via PBKDF2, nor do I need salt; this approach would waste a lot of time.

Using hashed random data as IV can have the same effect, both crypto.randomInt and crypto.randomUUID can generate random data. This approach will be less time consuming.