• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2const common = require('../common');
3
4if (!common.hasCrypto)
5  common.skip('missing crypto');
6
7const crypto = require('crypto');
8
9const zeros = Buffer.alloc;
10const key = zeros(16);
11const iv = zeros(16);
12
13const cipher = () => crypto.createCipheriv('aes-128-cbc', key, iv);
14const decipher = () => crypto.createDecipheriv('aes-128-cbc', key, iv);
15const hash = () => crypto.createSign('sha256');
16const hmac = () => crypto.createHmac('sha256', key);
17const sign = () => crypto.createSign('sha256');
18const verify = () => crypto.createVerify('sha256');
19
20for (const f of [cipher, decipher, hash, hmac, sign, verify])
21  for (const n of [15, 16])
22    f().update(zeros(n), 'hex');  // Should ignore inputEncoding.
23