xref: /third_party/node/test/parallel/test-crypto-update-encoding.js
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/node/test/parallel/
11cb0ef41Sopenharmony_ci'use strict';
21cb0ef41Sopenharmony_ciconst common = require('../common');
31cb0ef41Sopenharmony_ci
41cb0ef41Sopenharmony_ciif (!common.hasCrypto)
51cb0ef41Sopenharmony_ci  common.skip('missing crypto');
61cb0ef41Sopenharmony_ci
71cb0ef41Sopenharmony_ciconst crypto = require('crypto');
81cb0ef41Sopenharmony_ci
91cb0ef41Sopenharmony_ciconst zeros = Buffer.alloc;
101cb0ef41Sopenharmony_ciconst key = zeros(16);
111cb0ef41Sopenharmony_ciconst iv = zeros(16);
121cb0ef41Sopenharmony_ci
131cb0ef41Sopenharmony_ciconst cipher = () => crypto.createCipheriv('aes-128-cbc', key, iv);
141cb0ef41Sopenharmony_ciconst decipher = () => crypto.createDecipheriv('aes-128-cbc', key, iv);
151cb0ef41Sopenharmony_ciconst hash = () => crypto.createSign('sha256');
161cb0ef41Sopenharmony_ciconst hmac = () => crypto.createHmac('sha256', key);
171cb0ef41Sopenharmony_ciconst sign = () => crypto.createSign('sha256');
181cb0ef41Sopenharmony_ciconst verify = () => crypto.createVerify('sha256');
191cb0ef41Sopenharmony_ci
201cb0ef41Sopenharmony_cifor (const f of [cipher, decipher, hash, hmac, sign, verify])
211cb0ef41Sopenharmony_ci  for (const n of [15, 16])
221cb0ef41Sopenharmony_ci    f().update(zeros(n), 'hex');  // Should ignore inputEncoding.
23

Indexes created Thu Nov 07 10:32:03 CST 2024