Skip to content

Commit

Permalink
fix wrong iv length (#109)
Browse files Browse the repository at this point in the history
  • Loading branch information
xiazeyu committed Sep 15, 2019
1 parent 6535da2 commit 5ff3b67
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ hexo.extend.filter.register('after_post_render', (data) => {
log.info(`hexo-blog-encrypt: encrypting "${data.title.trim()}".`);

const key = crypto.pbkdf2Sync(password, keySalt, 1024, 256/8, 'sha256');
const iv = crypto.pbkdf2Sync(password, ivSalt, 512, 512, 'sha256');
const iv = crypto.pbkdf2Sync(password, ivSalt, 512, 16, 'sha256');

const cipher = crypto.createCipheriv('aes-256-cbc', key, iv);
const hmac = crypto.createHmac('sha256', key);
Expand Down
2 changes: 1 addition & 1 deletion lib/blog-encrypt.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@
'hash': 'SHA-256',
'salt': ivSalt.buffer,
'iterations': 512,
}, keyMaterial, 512 * 8);
}, keyMaterial, 16 * 8);
}

async function verifyContent(key, content) {
Expand Down

0 comments on commit 5ff3b67

Please sign in to comment.