Muka menggunakan html encode nodejs

Modul

let crypto;
try {
  crypto = await import('node:crypto');
} catch (err) {
  console.error('crypto support is disabled!');
}
0 menyediakan fungsionalitas kriptografi yang mencakup sekumpulan pembungkus untuk fungsi hash, HMAC, cipher, decipher, sign, dan verifikasi OpenSSL

Show

Menentukan apakah dukungan crypto tidak tersedia

Itu mungkin untuk Node.js. js yang akan dibangun tanpa menyertakan dukungan untuk modul

let crypto;
try {
  crypto = await import('node:crypto');
} catch (err) {
  console.error('crypto support is disabled!');
}
0. Dalam kasus seperti itu, mencoba untuk
let crypto;
try {
  crypto = await import('node:crypto');
} catch (err) {
  console.error('crypto support is disabled!');
}
_2 dari
let crypto;
try {
  crypto = await import('node:crypto');
} catch (err) {
  console.error('crypto support is disabled!');
}
3 atau menelepon
let crypto;
try {
  crypto = await import('node:crypto');
} catch (err) {
  console.error('crypto support is disabled!');
}
4 akan mengakibatkan kesalahan dilemparkan

Saat menggunakan CommonJS, kesalahan yang dilemparkan dapat ditangkap menggunakan try/catch

let crypto;
try {
  crypto = require('node:crypto');
} catch (err) {
  console.error('crypto support is disabled!');
}

Saat menggunakan kata kunci ESM leksikal

let crypto;
try {
  crypto = await import('node:crypto');
} catch (err) {
  console.error('crypto support is disabled!');
}
2, kesalahan hanya dapat ditangkap jika penangan untuk
let crypto;
try {
  crypto = await import('node:crypto');
} catch (err) {
  console.error('crypto support is disabled!');
}
6 terdaftar sebelum upaya apa pun untuk memuat modul dilakukan (menggunakan, misalnya, modul preload)

Saat menggunakan ESM, jika ada kemungkinan kode dapat dijalankan pada build Node. js di mana dukungan kripto tidak diaktifkan, pertimbangkan untuk menggunakan fungsi

let crypto;
try {
  crypto = await import('node:crypto');
} catch (err) {
  console.error('crypto support is disabled!');
}
7 daripada kata kunci leksikal
let crypto;
try {
  crypto = await import('node:crypto');
} catch (err) {
  console.error('crypto support is disabled!');
}
2

let crypto;
try {
  crypto = await import('node:crypto');
} catch (err) {
  console.error('crypto support is disabled!');
}

kelas. let crypto; try { crypto = await import('node:crypto'); } catch (err) { console.error('crypto support is disabled!'); }_9

SPKAC adalah mekanisme Permintaan Penandatanganan Sertifikat yang awalnya diterapkan oleh Netscape dan ditentukan secara resmi sebagai bagian dari elemen

const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
0 HTML5

const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
1 is deprecated since and new projects should not use this element anymore

The

let crypto;
try {
  crypto = await import('node:crypto');
} catch (err) {
  console.error('crypto support is disabled!');
}
0 module provides the
let crypto;
try {
  crypto = await import('node:crypto');
} catch (err) {
  console.error('crypto support is disabled!');
}
9 class for working with SPKAC data. The most common usage is handling output generated by the HTML5
const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
1 element. Node. js uses OpenSSL's SPKAC implementation internally

Static method.
const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
5

HistoryVersionChangesv15. 0. 0

The spkac argument can be an ArrayBuffer. Limited the size of the spkac argument to a maximum of 2**31 - 1 bytes

v9. 0. 0

Added in. v9. 0. 0

Static method.
const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
6

HistoryVersionChangesv15. 0. 0

The spkac argument can be an ArrayBuffer. Limited the size of the spkac argument to a maximum of 2**31 - 1 bytes

v9. 0. 0

Added in. v9. 0. 0

Static method.
const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
7

HistoryVersionChangesv15. 0. 0

The spkac argument can be an ArrayBuffer. Added encoding. Limited the size of the spkac argument to a maximum of 2**31 - 1 bytes

v9. 0. 0

Added in. v9. 0. 0

Legacy API

As a legacy interface, it is possible to create new instances of the

const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
8 class as illustrated in the examples below

const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
9

Instances of the

let crypto;
try {
  crypto = await import('node:crypto');
} catch (err) {
  console.error('crypto support is disabled!');
}
9 class can be created using the
const { createDiffieHellmanGroup } = await import('node:crypto');
const dh = createDiffieHellmanGroup('modp16');const { createDiffieHellmanGroup } = require('node:crypto');
const dh = createDiffieHellmanGroup('modp16');
1 keyword or by calling
const { createDiffieHellmanGroup } = await import('node:crypto');
const dh = createDiffieHellmanGroup('modp16');const { createDiffieHellmanGroup } = require('node:crypto');
const dh = createDiffieHellmanGroup('modp16');
2 as a function

const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
const { createDiffieHellmanGroup } = await import('node:crypto');
const dh = createDiffieHellmanGroup('modp16');const { createDiffieHellmanGroup } = require('node:crypto');
const dh = createDiffieHellmanGroup('modp16');
3
const { createDiffieHellmanGroup } = await import('node:crypto');
const dh = createDiffieHellmanGroup('modp16');const { createDiffieHellmanGroup } = require('node:crypto');
const dh = createDiffieHellmanGroup('modp16');
_4
const { createDiffieHellmanGroup } = await import('node:crypto');
const dh = createDiffieHellmanGroup('modp16');const { createDiffieHellmanGroup } = require('node:crypto');
const dh = createDiffieHellmanGroup('modp16');
5

Class. const { createDiffieHellmanGroup } = await import('node:crypto'); const dh = createDiffieHellmanGroup('modp16');const { createDiffieHellmanGroup } = require('node:crypto'); const dh = createDiffieHellmanGroup('modp16');6

Instances of the

const { createDiffieHellmanGroup } = await import('node:crypto');
const dh = createDiffieHellmanGroup('modp16');const { createDiffieHellmanGroup } = require('node:crypto');
const dh = createDiffieHellmanGroup('modp16');
6 class are used to encrypt data. The class can be used in one of two ways

  • As a stream that is both readable and writable, where plain unencrypted data is written to produce encrypted data on the readable side, or
  • Using the and methods to produce the encrypted data

The or methods are used to create

const { createDiffieHellmanGroup } = await import('node:crypto');
const dh = createDiffieHellmanGroup('modp16');const { createDiffieHellmanGroup } = require('node:crypto');
const dh = createDiffieHellmanGroup('modp16');
6 instances.
const { createDiffieHellmanGroup } = await import('node:crypto');
const dh = createDiffieHellmanGroup('modp16');const { createDiffieHellmanGroup } = require('node:crypto');
const dh = createDiffieHellmanGroup('modp16');
6 objects are not to be created directly using the
const { createDiffieHellmanGroup } = await import('node:crypto');
const dh = createDiffieHellmanGroup('modp16');const { createDiffieHellmanGroup } = require('node:crypto');
const dh = createDiffieHellmanGroup('modp16');
1 keyword

Example. Using

const { createDiffieHellmanGroup } = await import('node:crypto');
const dh = createDiffieHellmanGroup('modp16');const { createDiffieHellmanGroup } = require('node:crypto');
const dh = createDiffieHellmanGroup('modp16');
6 objects as streams

Example. Using

const { createDiffieHellmanGroup } = await import('node:crypto');
const dh = createDiffieHellmanGroup('modp16');const { createDiffieHellmanGroup } = require('node:crypto');
const dh = createDiffieHellmanGroup('modp16');
6 and piped streams

Example. Using the and methods

import { createReadStream } from 'node:fs';
import { stdout } from 'node:process';
const { createHash } = await import('node:crypto');

const hash = createHash('sha256');

const input = createReadStream('test.js');
input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
const { createHash } = require('node:crypto');
const { stdout } = require('node:process');

const hash = createHash('sha256');

const input = createReadStream('test.js');
input.pipe(hash).setEncoding('hex').pipe(stdout);
9

  • import { createReadStream } from 'node:fs';
    import { stdout } from 'node:process';
    const {
      createHmac,
    } = await import('node:crypto');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);const {
      createReadStream,
    } = require('node:fs');
    const {
      createHmac,
    } = require('node:crypto');
    const { stdout } = require('node:process');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);
    0 Nilai pengembalian
  • pengembalian. . Konten terenkripsi yang tersisa. Jika
    import { createReadStream } from 'node:fs';
    import { stdout } from 'node:process';
    const {
      createHmac,
    } = await import('node:crypto');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);const {
      createReadStream,
    } = require('node:fs');
    const {
      createHmac,
    } = require('node:crypto');
    const { stdout } = require('node:process');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);
    _0 ditentukan, sebuah string dikembalikan. Jika
    import { createReadStream } from 'node:fs';
    import { stdout } from 'node:process';
    const {
      createHmac,
    } = await import('node:crypto');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);const {
      createReadStream,
    } = require('node:fs');
    const {
      createHmac,
    } = require('node:crypto');
    const { stdout } = require('node:process');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);
    _0 tidak diberikan,
    import { createReadStream } from 'node:fs';
    import { stdout } from 'node:process';
    const {
      createHmac,
    } = await import('node:crypto');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);const {
      createReadStream,
    } = require('node:fs');
    const {
      createHmac,
    } = require('node:crypto');
    const { stdout } = require('node:process');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);
    3 dikembalikan

Setelah metode

const { createDiffieHellmanGroup } = await import('node:crypto');
const dh = createDiffieHellmanGroup('modp16');const { createDiffieHellmanGroup } = require('node:crypto');
const dh = createDiffieHellmanGroup('modp16');
_9 dipanggil, objek
const { createDiffieHellmanGroup } = await import('node:crypto');
const dh = createDiffieHellmanGroup('modp16');const { createDiffieHellmanGroup } = require('node:crypto');
const dh = createDiffieHellmanGroup('modp16');
6 tidak lagi dapat digunakan untuk mengenkripsi data. Upaya untuk memanggil
const { createDiffieHellmanGroup } = await import('node:crypto');
const dh = createDiffieHellmanGroup('modp16');const { createDiffieHellmanGroup } = require('node:crypto');
const dh = createDiffieHellmanGroup('modp16');
9 lebih dari sekali akan mengakibatkan kesalahan yang dilemparkan

import { createReadStream } from 'node:fs';
import { stdout } from 'node:process';
const {
  createHmac,
} = await import('node:crypto');

const hmac = createHmac('sha256', 'a secret');

const input = createReadStream('test.js');
input.pipe(hmac).pipe(stdout);const {
  createReadStream,
} = require('node:fs');
const {
  createHmac,
} = require('node:crypto');
const { stdout } = require('node:process');

const hmac = createHmac('sha256', 'a secret');

const input = createReadStream('test.js');
input.pipe(hmac).pipe(stdout);
_7

  • pengembalian. Saat menggunakan mode enkripsi yang diautentikasi (
    import { createReadStream } from 'node:fs';
    import { stdout } from 'node:process';
    const {
      createHmac,
    } = await import('node:crypto');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);const {
      createReadStream,
    } = require('node:fs');
    const {
      createHmac,
    } = require('node:crypto');
    const { stdout } = require('node:process');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);
    _8,
    import { createReadStream } from 'node:fs';
    import { stdout } from 'node:process';
    const {
      createHmac,
    } = await import('node:crypto');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);const {
      createReadStream,
    } = require('node:fs');
    const {
      createHmac,
    } = require('node:crypto');
    const { stdout } = require('node:process');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);
    _9,
    const { X509Certificate } = await import('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);
    _0, dan
    const { X509Certificate } = await import('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);
    1 saat ini didukung), metode
    import { createReadStream } from 'node:fs';
    import { stdout } from 'node:process';
    const {
      createHmac,
    } = await import('node:crypto');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);const {
      createReadStream,
    } = require('node:fs');
    const {
      createHmac,
    } = require('node:crypto');
    const { stdout } = require('node:process');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);
    7 mengembalikan
    import { createReadStream } from 'node:fs';
    import { stdout } from 'node:process';
    const {
      createHmac,
    } = await import('node:crypto');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);const {
      createReadStream,
    } = require('node:fs');
    const {
      createHmac,
    } = require('node:crypto');
    const { stdout } = require('node:process');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);
    3 berisi tag otentikasi yang telah dihitung dari data yang diberikan

Metode

import { createReadStream } from 'node:fs';
import { stdout } from 'node:process';
const {
  createHmac,
} = await import('node:crypto');

const hmac = createHmac('sha256', 'a secret');

const input = createReadStream('test.js');
input.pipe(hmac).pipe(stdout);const {
  createReadStream,
} = require('node:fs');
const {
  createHmac,
} = require('node:crypto');
const { stdout } = require('node:process');

const hmac = createHmac('sha256', 'a secret');

const input = createReadStream('test.js');
input.pipe(hmac).pipe(stdout);
_7 hanya boleh dipanggil setelah enkripsi selesai menggunakan metode tersebut

Jika opsi

const { X509Certificate } = await import('node:crypto');

const x509 = new X509Certificate('{.. pem encoded cert ...}');

console.log(x509.subject);const { X509Certificate } = require('node:crypto');

const x509 = new X509Certificate('{.. pem encoded cert ...}');

console.log(x509.subject);
6 ditetapkan selama pembuatan instance
const { X509Certificate } = await import('node:crypto');

const x509 = new X509Certificate('{.. pem encoded cert ...}');

console.log(x509.subject);const { X509Certificate } = require('node:crypto');

const x509 = new X509Certificate('{.. pem encoded cert ...}');

console.log(x509.subject);
7, fungsi ini akan mengembalikan persis
const { X509Certificate } = await import('node:crypto');

const x509 = new X509Certificate('{.. pem encoded cert ...}');

console.log(x509.subject);const { X509Certificate } = require('node:crypto');

const x509 = new X509Certificate('{.. pem encoded cert ...}');

console.log(x509.subject);
6 byte

const { X509Certificate } = await import('node:crypto');

const x509 = new X509Certificate('{.. pem encoded cert ...}');

console.log(x509.subject);const { X509Certificate } = require('node:crypto');

const x509 = new X509Certificate('{.. pem encoded cert ...}');

console.log(x509.subject);
_9

Saat menggunakan mode enkripsi yang diautentikasi (

import { createReadStream } from 'node:fs';
import { stdout } from 'node:process';
const {
  createHmac,
} = await import('node:crypto');

const hmac = createHmac('sha256', 'a secret');

const input = createReadStream('test.js');
input.pipe(hmac).pipe(stdout);const {
  createReadStream,
} = require('node:fs');
const {
  createHmac,
} = require('node:crypto');
const { stdout } = require('node:process');

const hmac = createHmac('sha256', 'a secret');

const input = createReadStream('test.js');
input.pipe(hmac).pipe(stdout);
_8,
import { createReadStream } from 'node:fs';
import { stdout } from 'node:process';
const {
  createHmac,
} = await import('node:crypto');

const hmac = createHmac('sha256', 'a secret');

const input = createReadStream('test.js');
input.pipe(hmac).pipe(stdout);const {
  createReadStream,
} = require('node:fs');
const {
  createHmac,
} = require('node:crypto');
const { stdout } = require('node:process');

const hmac = createHmac('sha256', 'a secret');

const input = createReadStream('test.js');
input.pipe(hmac).pipe(stdout);
_9,
const { X509Certificate } = await import('node:crypto');

const x509 = new X509Certificate('{.. pem encoded cert ...}');

console.log(x509.subject);const { X509Certificate } = require('node:crypto');

const x509 = new X509Certificate('{.. pem encoded cert ...}');

console.log(x509.subject);
_0, dan
const { X509Certificate } = await import('node:crypto');

const x509 = new X509Certificate('{.. pem encoded cert ...}');

console.log(x509.subject);const { X509Certificate } = require('node:crypto');

const x509 = new X509Certificate('{.. pem encoded cert ...}');

console.log(x509.subject);
1 saat ini didukung), metode
const {
  generateKeyPairSync,
} = await import('node:crypto');

const {
  publicKey,
  privateKey,
} = generateKeyPairSync('rsa', {
  modulusLength: 4096,
  publicKeyEncoding: {
    type: 'spki',
    format: 'pem',
  },
  privateKeyEncoding: {
    type: 'pkcs8',
    format: 'pem',
    cipher: 'aes-256-cbc',
    passphrase: 'top secret',
  },
});const {
  generateKeyPairSync,
} = require('node:crypto');

const {
  publicKey,
  privateKey,
} = generateKeyPairSync('rsa', {
  modulusLength: 4096,
  publicKeyEncoding: {
    type: 'spki',
    format: 'pem',
  },
  privateKeyEncoding: {
    type: 'pkcs8',
    format: 'pem',
    cipher: 'aes-256-cbc',
    passphrase: 'top secret',
  },
});
4 menetapkan nilai yang digunakan untuk parameter input data terotentikasi tambahan (AAD)

Opsi

const {
  generateKeyPairSync,
} = await import('node:crypto');

const {
  publicKey,
  privateKey,
} = generateKeyPairSync('rsa', {
  modulusLength: 4096,
  publicKeyEncoding: {
    type: 'spki',
    format: 'pem',
  },
  privateKeyEncoding: {
    type: 'pkcs8',
    format: 'pem',
    cipher: 'aes-256-cbc',
    passphrase: 'top secret',
  },
});const {
  generateKeyPairSync,
} = require('node:crypto');

const {
  publicKey,
  privateKey,
} = generateKeyPairSync('rsa', {
  modulusLength: 4096,
  publicKeyEncoding: {
    type: 'spki',
    format: 'pem',
  },
  privateKeyEncoding: {
    type: 'pkcs8',
    format: 'pem',
    cipher: 'aes-256-cbc',
    passphrase: 'top secret',
  },
});
_5 bersifat opsional untuk
import { createReadStream } from 'node:fs';
import { stdout } from 'node:process';
const {
  createHmac,
} = await import('node:crypto');

const hmac = createHmac('sha256', 'a secret');

const input = createReadStream('test.js');
input.pipe(hmac).pipe(stdout);const {
  createReadStream,
} = require('node:fs');
const {
  createHmac,
} = require('node:crypto');
const { stdout } = require('node:process');

const hmac = createHmac('sha256', 'a secret');

const input = createReadStream('test.js');
input.pipe(hmac).pipe(stdout);
8 dan
const { X509Certificate } = await import('node:crypto');

const x509 = new X509Certificate('{.. pem encoded cert ...}');

console.log(x509.subject);const { X509Certificate } = require('node:crypto');

const x509 = new X509Certificate('{.. pem encoded cert ...}');

console.log(x509.subject);
0. Saat menggunakan
import { createReadStream } from 'node:fs';
import { stdout } from 'node:process';
const {
  createHmac,
} = await import('node:crypto');

const hmac = createHmac('sha256', 'a secret');

const input = createReadStream('test.js');
input.pipe(hmac).pipe(stdout);const {
  createReadStream,
} = require('node:fs');
const {
  createHmac,
} = require('node:crypto');
const { stdout } = require('node:process');

const hmac = createHmac('sha256', 'a secret');

const input = createReadStream('test.js');
input.pipe(hmac).pipe(stdout);
9, opsi
const {
  generateKeyPairSync,
} = await import('node:crypto');

const {
  publicKey,
  privateKey,
} = generateKeyPairSync('rsa', {
  modulusLength: 4096,
  publicKeyEncoding: {
    type: 'spki',
    format: 'pem',
  },
  privateKeyEncoding: {
    type: 'pkcs8',
    format: 'pem',
    cipher: 'aes-256-cbc',
    passphrase: 'top secret',
  },
});const {
  generateKeyPairSync,
} = require('node:crypto');

const {
  publicKey,
  privateKey,
} = generateKeyPairSync('rsa', {
  modulusLength: 4096,
  publicKeyEncoding: {
    type: 'spki',
    format: 'pem',
  },
  privateKeyEncoding: {
    type: 'pkcs8',
    format: 'pem',
    cipher: 'aes-256-cbc',
    passphrase: 'top secret',
  },
});
5 harus ditentukan dan nilainya harus sesuai dengan panjang plaintext dalam byte. Lihat

Metode

const {
  generateKeyPairSync,
} = await import('node:crypto');

const {
  publicKey,
  privateKey,
} = generateKeyPairSync('rsa', {
  modulusLength: 4096,
  publicKeyEncoding: {
    type: 'spki',
    format: 'pem',
  },
  privateKeyEncoding: {
    type: 'pkcs8',
    format: 'pem',
    cipher: 'aes-256-cbc',
    passphrase: 'top secret',
  },
});const {
  generateKeyPairSync,
} = require('node:crypto');

const {
  publicKey,
  privateKey,
} = generateKeyPairSync('rsa', {
  modulusLength: 4096,
  publicKeyEncoding: {
    type: 'spki',
    format: 'pem',
  },
  privateKeyEncoding: {
    type: 'pkcs8',
    format: 'pem',
    cipher: 'aes-256-cbc',
    passphrase: 'top secret',
  },
});
_4 harus dipanggil sebelumnya

import { Buffer } from 'node:buffer';
const { randomFillSync } = await import('node:crypto');

const a = new Uint32Array(10);
console.log(Buffer.from(randomFillSync(a).buffer,
                        a.byteOffset, a.byteLength).toString('hex'));

const b = new DataView(new ArrayBuffer(10));
console.log(Buffer.from(randomFillSync(b).buffer,
                        b.byteOffset, b.byteLength).toString('hex'));

const c = new ArrayBuffer(10);
console.log(Buffer.from(randomFillSync(c)).toString('hex'));const { randomFillSync } = require('node:crypto');
const { Buffer } = require('node:buffer');

const a = new Uint32Array(10);
console.log(Buffer.from(randomFillSync(a).buffer,
                        a.byteOffset, a.byteLength).toString('hex'));

const b = new DataView(new ArrayBuffer(10));
console.log(Buffer.from(randomFillSync(b).buffer,
                        b.byteOffset, b.byteLength).toString('hex'));

const c = new ArrayBuffer(10);
console.log(Buffer.from(randomFillSync(c)).toString('hex'));
2

Saat menggunakan algoritma enkripsi blok, kelas

const { createDiffieHellmanGroup } = await import('node:crypto');
const dh = createDiffieHellmanGroup('modp16');const { createDiffieHellmanGroup } = require('node:crypto');
const dh = createDiffieHellmanGroup('modp16');
_6 akan secara otomatis menambahkan padding ke data input ke ukuran blok yang sesuai. Untuk menonaktifkan panggilan bantalan default
import { Buffer } from 'node:buffer';
const { randomFillSync } = await import('node:crypto');

const a = new Uint32Array(10);
console.log(Buffer.from(randomFillSync(a).buffer,
                        a.byteOffset, a.byteLength).toString('hex'));

const b = new DataView(new ArrayBuffer(10));
console.log(Buffer.from(randomFillSync(b).buffer,
                        b.byteOffset, b.byteLength).toString('hex'));

const c = new ArrayBuffer(10);
console.log(Buffer.from(randomFillSync(c)).toString('hex'));const { randomFillSync } = require('node:crypto');
const { Buffer } = require('node:buffer');

const a = new Uint32Array(10);
console.log(Buffer.from(randomFillSync(a).buffer,
                        a.byteOffset, a.byteLength).toString('hex'));

const b = new DataView(new ArrayBuffer(10));
console.log(Buffer.from(randomFillSync(b).buffer,
                        b.byteOffset, b.byteLength).toString('hex'));

const c = new ArrayBuffer(10);
console.log(Buffer.from(randomFillSync(c)).toString('hex'));
4

Ketika

import { Buffer } from 'node:buffer';
const { randomFillSync } = await import('node:crypto');

const a = new Uint32Array(10);
console.log(Buffer.from(randomFillSync(a).buffer,
                        a.byteOffset, a.byteLength).toString('hex'));

const b = new DataView(new ArrayBuffer(10));
console.log(Buffer.from(randomFillSync(b).buffer,
                        b.byteOffset, b.byteLength).toString('hex'));

const c = new ArrayBuffer(10);
console.log(Buffer.from(randomFillSync(c)).toString('hex'));const { randomFillSync } = require('node:crypto');
const { Buffer } = require('node:buffer');

const a = new Uint32Array(10);
console.log(Buffer.from(randomFillSync(a).buffer,
                        a.byteOffset, a.byteLength).toString('hex'));

const b = new DataView(new ArrayBuffer(10));
console.log(Buffer.from(randomFillSync(b).buffer,
                        b.byteOffset, b.byteLength).toString('hex'));

const c = new ArrayBuffer(10);
console.log(Buffer.from(randomFillSync(c)).toString('hex'));
5 adalah
import { Buffer } from 'node:buffer';
const { randomFillSync } = await import('node:crypto');

const a = new Uint32Array(10);
console.log(Buffer.from(randomFillSync(a).buffer,
                        a.byteOffset, a.byteLength).toString('hex'));

const b = new DataView(new ArrayBuffer(10));
console.log(Buffer.from(randomFillSync(b).buffer,
                        b.byteOffset, b.byteLength).toString('hex'));

const c = new ArrayBuffer(10);
console.log(Buffer.from(randomFillSync(c)).toString('hex'));const { randomFillSync } = require('node:crypto');
const { Buffer } = require('node:buffer');

const a = new Uint32Array(10);
console.log(Buffer.from(randomFillSync(a).buffer,
                        a.byteOffset, a.byteLength).toString('hex'));

const b = new DataView(new ArrayBuffer(10));
console.log(Buffer.from(randomFillSync(b).buffer,
                        b.byteOffset, b.byteLength).toString('hex'));

const c = new ArrayBuffer(10);
console.log(Buffer.from(randomFillSync(c)).toString('hex'));
6, panjang seluruh data input harus merupakan kelipatan dari ukuran blok cipher atau akan menimbulkan kesalahan. Menonaktifkan padding otomatis berguna untuk padding non-standar, misalnya menggunakan
import { Buffer } from 'node:buffer';
const { randomFillSync } = await import('node:crypto');

const a = new Uint32Array(10);
console.log(Buffer.from(randomFillSync(a).buffer,
                        a.byteOffset, a.byteLength).toString('hex'));

const b = new DataView(new ArrayBuffer(10));
console.log(Buffer.from(randomFillSync(b).buffer,
                        b.byteOffset, b.byteLength).toString('hex'));

const c = new ArrayBuffer(10);
console.log(Buffer.from(randomFillSync(c)).toString('hex'));const { randomFillSync } = require('node:crypto');
const { Buffer } = require('node:buffer');

const a = new Uint32Array(10);
console.log(Buffer.from(randomFillSync(a).buffer,
                        a.byteOffset, a.byteLength).toString('hex'));

const b = new DataView(new ArrayBuffer(10));
console.log(Buffer.from(randomFillSync(b).buffer,
                        b.byteOffset, b.byteLength).toString('hex'));

const c = new ArrayBuffer(10);
console.log(Buffer.from(randomFillSync(c)).toString('hex'));
_8 alih-alih padding PKCS

Metode

import { Buffer } from 'node:buffer';
const { randomFillSync } = await import('node:crypto');

const a = new Uint32Array(10);
console.log(Buffer.from(randomFillSync(a).buffer,
                        a.byteOffset, a.byteLength).toString('hex'));

const b = new DataView(new ArrayBuffer(10));
console.log(Buffer.from(randomFillSync(b).buffer,
                        b.byteOffset, b.byteLength).toString('hex'));

const c = new ArrayBuffer(10);
console.log(Buffer.from(randomFillSync(c)).toString('hex'));const { randomFillSync } = require('node:crypto');
const { Buffer } = require('node:buffer');

const a = new Uint32Array(10);
console.log(Buffer.from(randomFillSync(a).buffer,
                        a.byteOffset, a.byteLength).toString('hex'));

const b = new DataView(new ArrayBuffer(10));
console.log(Buffer.from(randomFillSync(b).buffer,
                        b.byteOffset, b.byteLength).toString('hex'));

const c = new ArrayBuffer(10);
console.log(Buffer.from(randomFillSync(c)).toString('hex'));
_9 harus dipanggil sebelumnya

import { Buffer } from 'node:buffer';
const { randomFill } = await import('node:crypto');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});const { randomFill } = require('node:crypto');
const { Buffer } = require('node:buffer');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});
1

HistoryVersionChangesv6. 0. 0

import { Buffer } from 'node:buffer';
const { randomFill } = await import('node:crypto');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});const { randomFill } = require('node:crypto');
const { Buffer } = require('node:buffer');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});
2 default diubah dari
import { Buffer } from 'node:buffer';
const { randomFill } = await import('node:crypto');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});const { randomFill } = require('node:crypto');
const { Buffer } = require('node:buffer');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});
3 menjadi
import { Buffer } from 'node:buffer';
const { randomFill } = await import('node:crypto');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});const { randomFill } = require('node:crypto');
const { Buffer } = require('node:buffer');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});
4

v0. 1. 94

ditambahkan. v0. 1. 94

Memperbarui sandi dengan

import { Buffer } from 'node:buffer';
const { randomFill } = await import('node:crypto');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});const { randomFill } = require('node:crypto');
const { Buffer } = require('node:buffer');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});
5. Jika argumen
import { Buffer } from 'node:buffer';
const { randomFill } = await import('node:crypto');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});const { randomFill } = require('node:crypto');
const { Buffer } = require('node:buffer');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});
_2 diberikan, argumen
import { Buffer } from 'node:buffer';
const { randomFill } = await import('node:crypto');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});const { randomFill } = require('node:crypto');
const { Buffer } = require('node:buffer');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});
5 adalah string menggunakan pengkodean yang ditentukan. Jika argumen
import { Buffer } from 'node:buffer';
const { randomFill } = await import('node:crypto');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});const { randomFill } = require('node:crypto');
const { Buffer } = require('node:buffer');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});
2 tidak diberikan,
import { Buffer } from 'node:buffer';
const { randomFill } = await import('node:crypto');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});const { randomFill } = require('node:crypto');
const { Buffer } = require('node:buffer');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});
5 harus berupa
import { createReadStream } from 'node:fs';
import { stdout } from 'node:process';
const {
  createHmac,
} = await import('node:crypto');

const hmac = createHmac('sha256', 'a secret');

const input = createReadStream('test.js');
input.pipe(hmac).pipe(stdout);const {
  createReadStream,
} = require('node:fs');
const {
  createHmac,
} = require('node:crypto');
const { stdout } = require('node:process');

const hmac = createHmac('sha256', 'a secret');

const input = createReadStream('test.js');
input.pipe(hmac).pipe(stdout);
3,
let crypto;
try {
  crypto = await import('node:crypto');
} catch (err) {
  console.error('crypto support is disabled!');
}
01, atau
let crypto;
try {
  crypto = await import('node:crypto');
} catch (err) {
  console.error('crypto support is disabled!');
}
02. Jika
import { Buffer } from 'node:buffer';
const { randomFill } = await import('node:crypto');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});const { randomFill } = require('node:crypto');
const { Buffer } = require('node:buffer');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});
_5 adalah
import { createReadStream } from 'node:fs';
import { stdout } from 'node:process';
const {
  createHmac,
} = await import('node:crypto');

const hmac = createHmac('sha256', 'a secret');

const input = createReadStream('test.js');
input.pipe(hmac).pipe(stdout);const {
  createReadStream,
} = require('node:fs');
const {
  createHmac,
} = require('node:crypto');
const { stdout } = require('node:process');

const hmac = createHmac('sha256', 'a secret');

const input = createReadStream('test.js');
input.pipe(hmac).pipe(stdout);
3,
let crypto;
try {
  crypto = await import('node:crypto');
} catch (err) {
  console.error('crypto support is disabled!');
}
01, atau
let crypto;
try {
  crypto = await import('node:crypto');
} catch (err) {
  console.error('crypto support is disabled!');
}
02, maka
import { Buffer } from 'node:buffer';
const { randomFill } = await import('node:crypto');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});const { randomFill } = require('node:crypto');
const { Buffer } = require('node:buffer');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});
2 diabaikan

import { createReadStream } from 'node:fs';
import { stdout } from 'node:process';
const {
  createHmac,
} = await import('node:crypto');

const hmac = createHmac('sha256', 'a secret');

const input = createReadStream('test.js');
input.pipe(hmac).pipe(stdout);const {
  createReadStream,
} = require('node:fs');
const {
  createHmac,
} = require('node:crypto');
const { stdout } = require('node:process');

const hmac = createHmac('sha256', 'a secret');

const input = createReadStream('test.js');
input.pipe(hmac).pipe(stdout);
_0 menentukan format output dari data yang dienkripsi. Jika
import { createReadStream } from 'node:fs';
import { stdout } from 'node:process';
const {
  createHmac,
} = await import('node:crypto');

const hmac = createHmac('sha256', 'a secret');

const input = createReadStream('test.js');
input.pipe(hmac).pipe(stdout);const {
  createReadStream,
} = require('node:fs');
const {
  createHmac,
} = require('node:crypto');
const { stdout } = require('node:process');

const hmac = createHmac('sha256', 'a secret');

const input = createReadStream('test.js');
input.pipe(hmac).pipe(stdout);
0 ditentukan, string yang menggunakan pengkodean yang ditentukan dikembalikan. Jika tidak ada
import { createReadStream } from 'node:fs';
import { stdout } from 'node:process';
const {
  createHmac,
} = await import('node:crypto');

const hmac = createHmac('sha256', 'a secret');

const input = createReadStream('test.js');
input.pipe(hmac).pipe(stdout);const {
  createReadStream,
} = require('node:fs');
const {
  createHmac,
} = require('node:crypto');
const { stdout } = require('node:process');

const hmac = createHmac('sha256', 'a secret');

const input = createReadStream('test.js');
input.pipe(hmac).pipe(stdout);
0 diberikan,
import { createReadStream } from 'node:fs';
import { stdout } from 'node:process';
const {
  createHmac,
} = await import('node:crypto');

const hmac = createHmac('sha256', 'a secret');

const input = createReadStream('test.js');
input.pipe(hmac).pipe(stdout);const {
  createReadStream,
} = require('node:fs');
const {
  createHmac,
} = require('node:crypto');
const { stdout } = require('node:process');

const hmac = createHmac('sha256', 'a secret');

const input = createReadStream('test.js');
input.pipe(hmac).pipe(stdout);
_3 dikembalikan

Metode _

const { createDiffieHellmanGroup } = await import('node:crypto');
const dh = createDiffieHellmanGroup('modp16');const { createDiffieHellmanGroup } = require('node:crypto');
const dh = createDiffieHellmanGroup('modp16');
_8 dapat dipanggil berkali-kali dengan data baru hingga dipanggil. Memanggil
const { createDiffieHellmanGroup } = await import('node:crypto');
const dh = createDiffieHellmanGroup('modp16');const { createDiffieHellmanGroup } = require('node:crypto');
const dh = createDiffieHellmanGroup('modp16');
_8 setelahnya akan menghasilkan kesalahan

kelas. let crypto; try { crypto = await import('node:crypto'); } catch (err) { console.error('crypto support is disabled!'); }_16

Contoh kelas

let crypto;
try {
  crypto = await import('node:crypto');
} catch (err) {
  console.error('crypto support is disabled!');
}
_16 digunakan untuk mendekripsi data. Kelas dapat digunakan dalam salah satu dari dua cara

  • Sebagai aliran yang dapat dibaca dan ditulis, di mana data terenkripsi biasa ditulis untuk menghasilkan data yang tidak terenkripsi di sisi yang dapat dibaca, atau
  • Menggunakan dan metode untuk menghasilkan data yang tidak terenkripsi

Metode or digunakan untuk membuat

let crypto;
try {
  crypto = await import('node:crypto');
} catch (err) {
  console.error('crypto support is disabled!');
}
16 instance.
let crypto;
try {
  crypto = await import('node:crypto');
} catch (err) {
  console.error('crypto support is disabled!');
}
16 objek tidak boleh dibuat langsung menggunakan kata kunci
const { createDiffieHellmanGroup } = await import('node:crypto');
const dh = createDiffieHellmanGroup('modp16');const { createDiffieHellmanGroup } = require('node:crypto');
const dh = createDiffieHellmanGroup('modp16');
1

Contoh. Menggunakan objek

let crypto;
try {
  crypto = await import('node:crypto');
} catch (err) {
  console.error('crypto support is disabled!');
}
_16 sebagai aliran

Contoh. Menggunakan

let crypto;
try {
  crypto = await import('node:crypto');
} catch (err) {
  console.error('crypto support is disabled!');
}
_16 dan aliran pipa

Example. Using the and methods

let crypto;
try {
  crypto = await import('node:crypto');
} catch (err) {
  console.error('crypto support is disabled!');
}
_29

  • import { createReadStream } from 'node:fs';
    import { stdout } from 'node:process';
    const {
      createHmac,
    } = await import('node:crypto');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);const {
      createReadStream,
    } = require('node:fs');
    const {
      createHmac,
    } = require('node:crypto');
    const { stdout } = require('node:process');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);
    0 Nilai pengembalian
  • pengembalian. . Konten yang diuraikan yang tersisa. Jika
    import { createReadStream } from 'node:fs';
    import { stdout } from 'node:process';
    const {
      createHmac,
    } = await import('node:crypto');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);const {
      createReadStream,
    } = require('node:fs');
    const {
      createHmac,
    } = require('node:crypto');
    const { stdout } = require('node:process');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);
    _0 ditentukan, sebuah string dikembalikan. Jika
    import { createReadStream } from 'node:fs';
    import { stdout } from 'node:process';
    const {
      createHmac,
    } = await import('node:crypto');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);const {
      createReadStream,
    } = require('node:fs');
    const {
      createHmac,
    } = require('node:crypto');
    const { stdout } = require('node:process');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);
    _0 tidak diberikan,
    import { createReadStream } from 'node:fs';
    import { stdout } from 'node:process';
    const {
      createHmac,
    } = await import('node:crypto');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);const {
      createReadStream,
    } = require('node:fs');
    const {
      createHmac,
    } = require('node:crypto');
    const { stdout } = require('node:process');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);
    3 dikembalikan

Setelah metode

let crypto;
try {
  crypto = await import('node:crypto');
} catch (err) {
  console.error('crypto support is disabled!');
}
_19 dipanggil, objek
let crypto;
try {
  crypto = await import('node:crypto');
} catch (err) {
  console.error('crypto support is disabled!');
}
16 tidak lagi dapat digunakan untuk mendekripsi data. Upaya untuk memanggil
let crypto;
try {
  crypto = await import('node:crypto');
} catch (err) {
  console.error('crypto support is disabled!');
}
_19 lebih dari sekali akan mengakibatkan kesalahan yang dilemparkan

let crypto;
try {
  crypto = await import('node:crypto');
} catch (err) {
  console.error('crypto support is disabled!');
}
_37

HistoryVersionChangesv15. 0. 0

Argumen buffer dapat berupa string atau ArrayBuffer dan dibatasi tidak lebih dari 2 ** 31 - 1 byte

v7. 2. 0

Metode ini sekarang mengembalikan referensi ke

let crypto;
try {
  crypto = await import('node:crypto');
} catch (err) {
  console.error('crypto support is disabled!');
}
38

v1. 0. 0

ditambahkan. v1. 0. 0

Saat menggunakan mode enkripsi yang diautentikasi (

import { createReadStream } from 'node:fs';
import { stdout } from 'node:process';
const {
  createHmac,
} = await import('node:crypto');

const hmac = createHmac('sha256', 'a secret');

const input = createReadStream('test.js');
input.pipe(hmac).pipe(stdout);const {
  createReadStream,
} = require('node:fs');
const {
  createHmac,
} = require('node:crypto');
const { stdout } = require('node:process');

const hmac = createHmac('sha256', 'a secret');

const input = createReadStream('test.js');
input.pipe(hmac).pipe(stdout);
_8,
import { createReadStream } from 'node:fs';
import { stdout } from 'node:process';
const {
  createHmac,
} = await import('node:crypto');

const hmac = createHmac('sha256', 'a secret');

const input = createReadStream('test.js');
input.pipe(hmac).pipe(stdout);const {
  createReadStream,
} = require('node:fs');
const {
  createHmac,
} = require('node:crypto');
const { stdout } = require('node:process');

const hmac = createHmac('sha256', 'a secret');

const input = createReadStream('test.js');
input.pipe(hmac).pipe(stdout);
_9,
const { X509Certificate } = await import('node:crypto');

const x509 = new X509Certificate('{.. pem encoded cert ...}');

console.log(x509.subject);const { X509Certificate } = require('node:crypto');

const x509 = new X509Certificate('{.. pem encoded cert ...}');

console.log(x509.subject);
_0, dan
const { X509Certificate } = await import('node:crypto');

const x509 = new X509Certificate('{.. pem encoded cert ...}');

console.log(x509.subject);const { X509Certificate } = require('node:crypto');

const x509 = new X509Certificate('{.. pem encoded cert ...}');

console.log(x509.subject);
1 saat ini didukung), metode
let crypto;
try {
  crypto = await import('node:crypto');
} catch (err) {
  console.error('crypto support is disabled!');
}
43 menetapkan nilai yang digunakan untuk parameter input data terotentikasi tambahan (AAD)

Argumen

let crypto;
try {
  crypto = await import('node:crypto');
} catch (err) {
  console.error('crypto support is disabled!');
}
44 bersifat opsional untuk
import { createReadStream } from 'node:fs';
import { stdout } from 'node:process';
const {
  createHmac,
} = await import('node:crypto');

const hmac = createHmac('sha256', 'a secret');

const input = createReadStream('test.js');
input.pipe(hmac).pipe(stdout);const {
  createReadStream,
} = require('node:fs');
const {
  createHmac,
} = require('node:crypto');
const { stdout } = require('node:process');

const hmac = createHmac('sha256', 'a secret');

const input = createReadStream('test.js');
input.pipe(hmac).pipe(stdout);
8. Saat menggunakan
import { createReadStream } from 'node:fs';
import { stdout } from 'node:process';
const {
  createHmac,
} = await import('node:crypto');

const hmac = createHmac('sha256', 'a secret');

const input = createReadStream('test.js');
input.pipe(hmac).pipe(stdout);const {
  createReadStream,
} = require('node:fs');
const {
  createHmac,
} = require('node:crypto');
const { stdout } = require('node:process');

const hmac = createHmac('sha256', 'a secret');

const input = createReadStream('test.js');
input.pipe(hmac).pipe(stdout);
9, opsi
const {
  generateKeyPairSync,
} = await import('node:crypto');

const {
  publicKey,
  privateKey,
} = generateKeyPairSync('rsa', {
  modulusLength: 4096,
  publicKeyEncoding: {
    type: 'spki',
    format: 'pem',
  },
  privateKeyEncoding: {
    type: 'pkcs8',
    format: 'pem',
    cipher: 'aes-256-cbc',
    passphrase: 'top secret',
  },
});const {
  generateKeyPairSync,
} = require('node:crypto');

const {
  publicKey,
  privateKey,
} = generateKeyPairSync('rsa', {
  modulusLength: 4096,
  publicKeyEncoding: {
    type: 'spki',
    format: 'pem',
  },
  privateKeyEncoding: {
    type: 'pkcs8',
    format: 'pem',
    cipher: 'aes-256-cbc',
    passphrase: 'top secret',
  },
});
5 harus ditentukan dan nilainya harus sesuai dengan panjang ciphertext dalam byte. Lihat

Metode

let crypto;
try {
  crypto = await import('node:crypto');
} catch (err) {
  console.error('crypto support is disabled!');
}
43 harus dipanggil sebelumnya

Saat meneruskan string sebagai

let crypto;
try {
  crypto = await import('node:crypto');
} catch (err) {
  console.error('crypto support is disabled!');
}
_50, harap pertimbangkan

let crypto;
try {
  crypto = await import('node:crypto');
} catch (err) {
  console.error('crypto support is disabled!');
}
_51

HistoryVersionChangesv15. 0. 0

Argumen buffer dapat berupa string atau ArrayBuffer dan dibatasi tidak lebih dari 2 ** 31 - 1 byte

v11. 0. 0

Metode ini sekarang muncul jika panjang tag GCM tidak valid

v7. 2. 0

Metode ini sekarang mengembalikan referensi ke

let crypto;
try {
  crypto = await import('node:crypto');
} catch (err) {
  console.error('crypto support is disabled!');
}
38

v1. 0. 0

ditambahkan. v1. 0. 0

Saat menggunakan mode enkripsi yang diautentikasi (

import { createReadStream } from 'node:fs';
import { stdout } from 'node:process';
const {
  createHmac,
} = await import('node:crypto');

const hmac = createHmac('sha256', 'a secret');

const input = createReadStream('test.js');
input.pipe(hmac).pipe(stdout);const {
  createReadStream,
} = require('node:fs');
const {
  createHmac,
} = require('node:crypto');
const { stdout } = require('node:process');

const hmac = createHmac('sha256', 'a secret');

const input = createReadStream('test.js');
input.pipe(hmac).pipe(stdout);
_8,
import { createReadStream } from 'node:fs';
import { stdout } from 'node:process';
const {
  createHmac,
} = await import('node:crypto');

const hmac = createHmac('sha256', 'a secret');

const input = createReadStream('test.js');
input.pipe(hmac).pipe(stdout);const {
  createReadStream,
} = require('node:fs');
const {
  createHmac,
} = require('node:crypto');
const { stdout } = require('node:process');

const hmac = createHmac('sha256', 'a secret');

const input = createReadStream('test.js');
input.pipe(hmac).pipe(stdout);
_9,
const { X509Certificate } = await import('node:crypto');

const x509 = new X509Certificate('{.. pem encoded cert ...}');

console.log(x509.subject);const { X509Certificate } = require('node:crypto');

const x509 = new X509Certificate('{.. pem encoded cert ...}');

console.log(x509.subject);
_0, dan
const { X509Certificate } = await import('node:crypto');

const x509 = new X509Certificate('{.. pem encoded cert ...}');

console.log(x509.subject);const { X509Certificate } = require('node:crypto');

const x509 = new X509Certificate('{.. pem encoded cert ...}');

console.log(x509.subject);
1 saat ini didukung), metode
let crypto;
try {
  crypto = await import('node:crypto');
} catch (err) {
  console.error('crypto support is disabled!');
}
57 digunakan untuk meneruskan tag autentikasi yang diterima. Jika tidak ada tag yang diberikan, atau jika teks sandi telah dirusak, akan dibuang, menunjukkan bahwa teks sandi harus dibuang karena otentikasi gagal. Jika panjang tag tidak valid menurut NIST SP 800-38D atau tidak cocok dengan nilai opsi
const { X509Certificate } = await import('node:crypto');

const x509 = new X509Certificate('{.. pem encoded cert ...}');

console.log(x509.subject);const { X509Certificate } = require('node:crypto');

const x509 = new X509Certificate('{.. pem encoded cert ...}');

console.log(x509.subject);
_6,
let crypto;
try {
  crypto = await import('node:crypto');
} catch (err) {
  console.error('crypto support is disabled!');
}
57 akan menimbulkan kesalahan

Metode

let crypto;
try {
  crypto = await import('node:crypto');
} catch (err) {
  console.error('crypto support is disabled!');
}
57 harus dipanggil sebelumnya untuk mode
import { createReadStream } from 'node:fs';
import { stdout } from 'node:process';
const {
  createHmac,
} = await import('node:crypto');

const hmac = createHmac('sha256', 'a secret');

const input = createReadStream('test.js');
input.pipe(hmac).pipe(stdout);const {
  createReadStream,
} = require('node:fs');
const {
  createHmac,
} = require('node:crypto');
const { stdout } = require('node:process');

const hmac = createHmac('sha256', 'a secret');

const input = createReadStream('test.js');
input.pipe(hmac).pipe(stdout);
9 atau sebelumnya untuk mode
import { createReadStream } from 'node:fs';
import { stdout } from 'node:process';
const {
  createHmac,
} = await import('node:crypto');

const hmac = createHmac('sha256', 'a secret');

const input = createReadStream('test.js');
input.pipe(hmac).pipe(stdout);const {
  createReadStream,
} = require('node:fs');
const {
  createHmac,
} = require('node:crypto');
const { stdout } = require('node:process');

const hmac = createHmac('sha256', 'a secret');

const input = createReadStream('test.js');
input.pipe(hmac).pipe(stdout);
8 dan
const { X509Certificate } = await import('node:crypto');

const x509 = new X509Certificate('{.. pem encoded cert ...}');

console.log(x509.subject);const { X509Certificate } = require('node:crypto');

const x509 = new X509Certificate('{.. pem encoded cert ...}');

console.log(x509.subject);
0 dan
const { X509Certificate } = await import('node:crypto');

const x509 = new X509Certificate('{.. pem encoded cert ...}');

console.log(x509.subject);const { X509Certificate } = require('node:crypto');

const x509 = new X509Certificate('{.. pem encoded cert ...}');

console.log(x509.subject);
1.
let crypto;
try {
  crypto = await import('node:crypto');
} catch (err) {
  console.error('crypto support is disabled!');
}
_57 hanya dapat dipanggil satu kali

Saat meneruskan string sebagai tag autentikasi, harap pertimbangkan

let crypto;
try {
  crypto = await import('node:crypto');
} catch (err) {
  console.error('crypto support is disabled!');
}
_69

Ketika data telah dienkripsi tanpa padding blok standar, panggilan

let crypto;
try {
  crypto = await import('node:crypto');
} catch (err) {
  console.error('crypto support is disabled!');
}
70 akan menonaktifkan padding otomatis untuk mencegah pemeriksaan dan penghapusan padding

Mematikan padding otomatis hanya akan berfungsi jika panjang data input adalah kelipatan dari ukuran blok cipher

Metode

let crypto;
try {
  crypto = await import('node:crypto');
} catch (err) {
  console.error('crypto support is disabled!');
}
72 harus dipanggil sebelumnya

let crypto;
try {
  crypto = await import('node:crypto');
} catch (err) {
  console.error('crypto support is disabled!');
}
_74

HistoryVersionChangesv6. 0. 0

import { Buffer } from 'node:buffer';
const { randomFill } = await import('node:crypto');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});const { randomFill } = require('node:crypto');
const { Buffer } = require('node:buffer');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});
2 default diubah dari
import { Buffer } from 'node:buffer';
const { randomFill } = await import('node:crypto');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});const { randomFill } = require('node:crypto');
const { Buffer } = require('node:buffer');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});
3 menjadi
import { Buffer } from 'node:buffer';
const { randomFill } = await import('node:crypto');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});const { randomFill } = require('node:crypto');
const { Buffer } = require('node:buffer');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});
4

v0. 1. 94

ditambahkan. v0. 1. 94

Memperbarui penguraian dengan

import { Buffer } from 'node:buffer';
const { randomFill } = await import('node:crypto');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});const { randomFill } = require('node:crypto');
const { Buffer } = require('node:buffer');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});
5. Jika argumen
import { Buffer } from 'node:buffer';
const { randomFill } = await import('node:crypto');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});const { randomFill } = require('node:crypto');
const { Buffer } = require('node:buffer');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});
_2 diberikan, argumen
import { Buffer } from 'node:buffer';
const { randomFill } = await import('node:crypto');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});const { randomFill } = require('node:crypto');
const { Buffer } = require('node:buffer');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});
5 adalah string menggunakan pengkodean yang ditentukan. Jika argumen
import { Buffer } from 'node:buffer';
const { randomFill } = await import('node:crypto');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});const { randomFill } = require('node:crypto');
const { Buffer } = require('node:buffer');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});
_2 tidak diberikan,
import { Buffer } from 'node:buffer';
const { randomFill } = await import('node:crypto');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});const { randomFill } = require('node:crypto');
const { Buffer } = require('node:buffer');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});
5 harus berupa
import { createReadStream } from 'node:fs';
import { stdout } from 'node:process';
const {
  createHmac,
} = await import('node:crypto');

const hmac = createHmac('sha256', 'a secret');

const input = createReadStream('test.js');
input.pipe(hmac).pipe(stdout);const {
  createReadStream,
} = require('node:fs');
const {
  createHmac,
} = require('node:crypto');
const { stdout } = require('node:process');

const hmac = createHmac('sha256', 'a secret');

const input = createReadStream('test.js');
input.pipe(hmac).pipe(stdout);
3. Jika
import { Buffer } from 'node:buffer';
const { randomFill } = await import('node:crypto');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});const { randomFill } = require('node:crypto');
const { Buffer } = require('node:buffer');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});
5 adalah
import { createReadStream } from 'node:fs';
import { stdout } from 'node:process';
const {
  createHmac,
} = await import('node:crypto');

const hmac = createHmac('sha256', 'a secret');

const input = createReadStream('test.js');
input.pipe(hmac).pipe(stdout);const {
  createReadStream,
} = require('node:fs');
const {
  createHmac,
} = require('node:crypto');
const { stdout } = require('node:process');

const hmac = createHmac('sha256', 'a secret');

const input = createReadStream('test.js');
input.pipe(hmac).pipe(stdout);
3 maka
import { Buffer } from 'node:buffer';
const { randomFill } = await import('node:crypto');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});const { randomFill } = require('node:crypto');
const { Buffer } = require('node:buffer');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});
2 diabaikan

import { createReadStream } from 'node:fs';
import { stdout } from 'node:process';
const {
  createHmac,
} = await import('node:crypto');

const hmac = createHmac('sha256', 'a secret');

const input = createReadStream('test.js');
input.pipe(hmac).pipe(stdout);const {
  createReadStream,
} = require('node:fs');
const {
  createHmac,
} = require('node:crypto');
const { stdout } = require('node:process');

const hmac = createHmac('sha256', 'a secret');

const input = createReadStream('test.js');
input.pipe(hmac).pipe(stdout);
_0 menentukan format output dari data yang dienkripsi. Jika
import { createReadStream } from 'node:fs';
import { stdout } from 'node:process';
const {
  createHmac,
} = await import('node:crypto');

const hmac = createHmac('sha256', 'a secret');

const input = createReadStream('test.js');
input.pipe(hmac).pipe(stdout);const {
  createReadStream,
} = require('node:fs');
const {
  createHmac,
} = require('node:crypto');
const { stdout } = require('node:process');

const hmac = createHmac('sha256', 'a secret');

const input = createReadStream('test.js');
input.pipe(hmac).pipe(stdout);
0 ditentukan, string yang menggunakan pengkodean yang ditentukan dikembalikan. Jika tidak ada
import { createReadStream } from 'node:fs';
import { stdout } from 'node:process';
const {
  createHmac,
} = await import('node:crypto');

const hmac = createHmac('sha256', 'a secret');

const input = createReadStream('test.js');
input.pipe(hmac).pipe(stdout);const {
  createReadStream,
} = require('node:fs');
const {
  createHmac,
} = require('node:crypto');
const { stdout } = require('node:process');

const hmac = createHmac('sha256', 'a secret');

const input = createReadStream('test.js');
input.pipe(hmac).pipe(stdout);
0 diberikan,
import { createReadStream } from 'node:fs';
import { stdout } from 'node:process';
const {
  createHmac,
} = await import('node:crypto');

const hmac = createHmac('sha256', 'a secret');

const input = createReadStream('test.js');
input.pipe(hmac).pipe(stdout);const {
  createReadStream,
} = require('node:fs');
const {
  createHmac,
} = require('node:crypto');
const { stdout } = require('node:process');

const hmac = createHmac('sha256', 'a secret');

const input = createReadStream('test.js');
input.pipe(hmac).pipe(stdout);
_3 dikembalikan

Metode

let crypto;
try {
  crypto = await import('node:crypto');
} catch (err) {
  console.error('crypto support is disabled!');
}
18 dapat dipanggil beberapa kali dengan data baru hingga dipanggil. Memanggil
let crypto;
try {
  crypto = await import('node:crypto');
} catch (err) {
  console.error('crypto support is disabled!');
}
_18 setelahnya akan menghasilkan kesalahan

kelas. let crypto; try { crypto = await import('node:crypto'); } catch (err) { console.error('crypto support is disabled!'); }_95

Kelas

let crypto;
try {
  crypto = await import('node:crypto');
} catch (err) {
  console.error('crypto support is disabled!');
}
95 adalah utilitas untuk membuat pertukaran kunci Diffie-Hellman

Instance kelas

let crypto;
try {
  crypto = await import('node:crypto');
} catch (err) {
  console.error('crypto support is disabled!');
}
_95 dapat dibuat menggunakan fungsi

let crypto;
try {
  crypto = await import('node:crypto');
} catch (err) {
  console.error('crypto support is disabled!');
}
_99

Menghitung rahasia bersama menggunakan

const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
00 sebagai kunci publik pihak lain dan mengembalikan rahasia bersama yang dihitung. Kunci yang disediakan ditafsirkan menggunakan
import { Buffer } from 'node:buffer';
const { randomFill } = await import('node:crypto');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});const { randomFill } = require('node:crypto');
const { Buffer } = require('node:buffer');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});
2 yang ditentukan, dan rahasia dikodekan menggunakan
import { createReadStream } from 'node:fs';
import { stdout } from 'node:process';
const {
  createHmac,
} = await import('node:crypto');

const hmac = createHmac('sha256', 'a secret');

const input = createReadStream('test.js');
input.pipe(hmac).pipe(stdout);const {
  createReadStream,
} = require('node:fs');
const {
  createHmac,
} = require('node:crypto');
const { stdout } = require('node:process');

const hmac = createHmac('sha256', 'a secret');

const input = createReadStream('test.js');
input.pipe(hmac).pipe(stdout);
0 yang ditentukan. Jika
import { Buffer } from 'node:buffer';
const { randomFill } = await import('node:crypto');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});const { randomFill } = require('node:crypto');
const { Buffer } = require('node:buffer');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});
_2 tidak diberikan,
const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
00 diharapkan menjadi
import { createReadStream } from 'node:fs';
import { stdout } from 'node:process';
const {
  createHmac,
} = await import('node:crypto');

const hmac = createHmac('sha256', 'a secret');

const input = createReadStream('test.js');
input.pipe(hmac).pipe(stdout);const {
  createReadStream,
} = require('node:fs');
const {
  createHmac,
} = require('node:crypto');
const { stdout } = require('node:process');

const hmac = createHmac('sha256', 'a secret');

const input = createReadStream('test.js');
input.pipe(hmac).pipe(stdout);
3,
let crypto;
try {
  crypto = await import('node:crypto');
} catch (err) {
  console.error('crypto support is disabled!');
}
01, atau
let crypto;
try {
  crypto = await import('node:crypto');
} catch (err) {
  console.error('crypto support is disabled!');
}
02

Jika

import { createReadStream } from 'node:fs';
import { stdout } from 'node:process';
const {
  createHmac,
} = await import('node:crypto');

const hmac = createHmac('sha256', 'a secret');

const input = createReadStream('test.js');
input.pipe(hmac).pipe(stdout);const {
  createReadStream,
} = require('node:fs');
const {
  createHmac,
} = require('node:crypto');
const { stdout } = require('node:process');

const hmac = createHmac('sha256', 'a secret');

const input = createReadStream('test.js');
input.pipe(hmac).pipe(stdout);
_0 diberikan, sebuah string dikembalikan;

const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
10

Menghasilkan nilai kunci Diffie-Hellman pribadi dan publik, dan mengembalikan kunci publik dalam

const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
11 yang ditentukan. Kunci ini harus ditransfer ke pihak lain. Jika
const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
_11 disediakan, sebuah string dikembalikan;

const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
14

Mengembalikan generator Diffie-Hellman di

const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
11 yang ditentukan. Jika
const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
_11 disediakan, sebuah string dikembalikan;

const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
_18

Mengembalikan bilangan prima Diffie-Hellman dalam

const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
11 yang ditentukan. Jika
const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
_11 disediakan, sebuah string dikembalikan;

const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
_22

Mengembalikan kunci pribadi Diffie-Hellman di

const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
11 yang ditentukan. Jika
const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
_11 disediakan, sebuah string dikembalikan;

const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
_26

Mengembalikan kunci publik Diffie-Hellman dalam

const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
11 yang ditentukan. Jika
const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
_11 disediakan, sebuah string dikembalikan;

const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
_30

Menyetel kunci pribadi Diffie-Hellman. Jika argumen

const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
_11 diberikan,
const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
32 diharapkan berupa string. Jika tidak ada
const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
_11 yang diberikan,
const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
32 diharapkan menjadi
import { createReadStream } from 'node:fs';
import { stdout } from 'node:process';
const {
  createHmac,
} = await import('node:crypto');

const hmac = createHmac('sha256', 'a secret');

const input = createReadStream('test.js');
input.pipe(hmac).pipe(stdout);const {
  createReadStream,
} = require('node:fs');
const {
  createHmac,
} = require('node:crypto');
const { stdout } = require('node:process');

const hmac = createHmac('sha256', 'a secret');

const input = createReadStream('test.js');
input.pipe(hmac).pipe(stdout);
3,
let crypto;
try {
  crypto = await import('node:crypto');
} catch (err) {
  console.error('crypto support is disabled!');
}
01, atau
let crypto;
try {
  crypto = await import('node:crypto');
} catch (err) {
  console.error('crypto support is disabled!');
}
02

const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
_38

Menetapkan kunci publik Diffie-Hellman. Jika argumen

const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
_11 diberikan,
const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
40 diharapkan berupa string. Jika tidak ada
const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
_11 yang diberikan,
const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
40 diharapkan menjadi
import { createReadStream } from 'node:fs';
import { stdout } from 'node:process';
const {
  createHmac,
} = await import('node:crypto');

const hmac = createHmac('sha256', 'a secret');

const input = createReadStream('test.js');
input.pipe(hmac).pipe(stdout);const {
  createReadStream,
} = require('node:fs');
const {
  createHmac,
} = require('node:crypto');
const { stdout } = require('node:process');

const hmac = createHmac('sha256', 'a secret');

const input = createReadStream('test.js');
input.pipe(hmac).pipe(stdout);
3,
let crypto;
try {
  crypto = await import('node:crypto');
} catch (err) {
  console.error('crypto support is disabled!');
}
01, atau
let crypto;
try {
  crypto = await import('node:crypto');
} catch (err) {
  console.error('crypto support is disabled!');
}
02

const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
_46

Bidang bit berisi peringatan dan/atau kesalahan apa pun yang dihasilkan dari pemeriksaan yang dilakukan selama inisialisasi objek

let crypto;
try {
  crypto = await import('node:crypto');
} catch (err) {
  console.error('crypto support is disabled!');
}
95

Nilai-nilai berikut berlaku untuk properti ini (sebagaimana didefinisikan dalam modul

const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
48)

  • const { Certificate } = await import('node:crypto');
    
    const cert1 = new Certificate();
    const cert2 = Certificate();const { Certificate } = require('node:crypto');
    
    const cert1 = new Certificate();
    const cert2 = Certificate();
    _49
  • const { Certificate } = await import('node:crypto');
    
    const cert1 = new Certificate();
    const cert2 = Certificate();const { Certificate } = require('node:crypto');
    
    const cert1 = new Certificate();
    const cert2 = Certificate();
    50
  • const { Certificate } = await import('node:crypto');
    
    const cert1 = new Certificate();
    const cert2 = Certificate();const { Certificate } = require('node:crypto');
    
    const cert1 = new Certificate();
    const cert2 = Certificate();
    _51
  • const { Certificate } = await import('node:crypto');
    
    const cert1 = new Certificate();
    const cert2 = Certificate();const { Certificate } = require('node:crypto');
    
    const cert1 = new Certificate();
    const cert2 = Certificate();
    52

kelas. const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();53

Kelas

const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
_53 menggunakan grup modp terkenal sebagai argumennya. Ia bekerja sama dengan
let crypto;
try {
  crypto = await import('node:crypto');
} catch (err) {
  console.error('crypto support is disabled!');
}
_95, kecuali bahwa ia tidak mengizinkan pengubahan kuncinya setelah pembuatan. Dengan kata lain, itu tidak menerapkan metode
const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
56 atau
const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
57

const { createDiffieHellmanGroup } = await import('node:crypto');
const dh = createDiffieHellmanGroup('modp16');const { createDiffieHellmanGroup } = require('node:crypto');
const dh = createDiffieHellmanGroup('modp16');

Grup berikut ini didukung

Grup berikut masih didukung tetapi tidak digunakan lagi (lihat )

Grup yang tidak digunakan lagi ini mungkin dihapus di versi Node yang akan datang. js

kelas. const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();_58

Kelas

const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
_58 adalah utilitas untuk membuat pertukaran kunci Elliptic Curve Diffie-Hellman (ECDH)

Instance kelas

const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
_58 dapat dibuat menggunakan fungsi

Metode statis.
const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
_62

Mengonversi kunci publik EC Diffie-Hellman yang ditentukan oleh

const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
63 dan
const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
64 ke format yang ditentukan oleh
const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
65. Argumen
const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
_65 menentukan penyandian titik dan dapat berupa
const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
67,
const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
68 atau
const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
69. Kunci yang disediakan ditafsirkan menggunakan
import { Buffer } from 'node:buffer';
const { randomFill } = await import('node:crypto');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});const { randomFill } = require('node:crypto');
const { Buffer } = require('node:buffer');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});
2 yang ditentukan, dan kunci yang dikembalikan dikodekan menggunakan
import { createReadStream } from 'node:fs';
import { stdout } from 'node:process';
const {
  createHmac,
} = await import('node:crypto');

const hmac = createHmac('sha256', 'a secret');

const input = createReadStream('test.js');
input.pipe(hmac).pipe(stdout);const {
  createReadStream,
} = require('node:fs');
const {
  createHmac,
} = require('node:crypto');
const { stdout } = require('node:process');

const hmac = createHmac('sha256', 'a secret');

const input = createReadStream('test.js');
input.pipe(hmac).pipe(stdout);
0 yang ditentukan

Gunakan untuk mendapatkan daftar nama kurva yang tersedia. Pada rilis OpenSSL terbaru,

const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
73 juga akan menampilkan nama dan deskripsi dari setiap kurva eliptik yang tersedia

Jika

const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
_65 tidak ditentukan, poin akan dikembalikan dalam format
const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
68

Jika

import { Buffer } from 'node:buffer';
const { randomFill } = await import('node:crypto');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});const { randomFill } = require('node:crypto');
const { Buffer } = require('node:buffer');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});
_2 tidak diberikan,
const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
63 diharapkan menjadi
import { createReadStream } from 'node:fs';
import { stdout } from 'node:process';
const {
  createHmac,
} = await import('node:crypto');

const hmac = createHmac('sha256', 'a secret');

const input = createReadStream('test.js');
input.pipe(hmac).pipe(stdout);const {
  createReadStream,
} = require('node:fs');
const {
  createHmac,
} = require('node:crypto');
const { stdout } = require('node:process');

const hmac = createHmac('sha256', 'a secret');

const input = createReadStream('test.js');
input.pipe(hmac).pipe(stdout);
3,
let crypto;
try {
  crypto = await import('node:crypto');
} catch (err) {
  console.error('crypto support is disabled!');
}
01, atau
let crypto;
try {
  crypto = await import('node:crypto');
} catch (err) {
  console.error('crypto support is disabled!');
}
02

Contoh (membuka kompresi kunci)

const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
_81

HistoryVersionChangesv10. 0. 0

Mengubah format kesalahan untuk lebih mendukung kesalahan kunci publik yang tidak valid

v6. 0. 0

import { Buffer } from 'node:buffer';
const { randomFill } = await import('node:crypto');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});const { randomFill } = require('node:crypto');
const { Buffer } = require('node:buffer');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});
2 default diubah dari
import { Buffer } from 'node:buffer';
const { randomFill } = await import('node:crypto');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});const { randomFill } = require('node:crypto');
const { Buffer } = require('node:buffer');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});
3 menjadi
import { Buffer } from 'node:buffer';
const { randomFill } = await import('node:crypto');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});const { randomFill } = require('node:crypto');
const { Buffer } = require('node:buffer');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});
4

v0. sebelas. 14

ditambahkan. v0. sebelas. 14

Menghitung rahasia bersama menggunakan

const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
00 sebagai kunci publik pihak lain dan mengembalikan rahasia bersama yang dihitung. Kunci yang disediakan diinterpretasikan menggunakan
import { Buffer } from 'node:buffer';
const { randomFill } = await import('node:crypto');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});const { randomFill } = require('node:crypto');
const { Buffer } = require('node:buffer');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});
2 yang ditentukan, dan rahasia yang dikembalikan dikodekan menggunakan
import { createReadStream } from 'node:fs';
import { stdout } from 'node:process';
const {
  createHmac,
} = await import('node:crypto');

const hmac = createHmac('sha256', 'a secret');

const input = createReadStream('test.js');
input.pipe(hmac).pipe(stdout);const {
  createReadStream,
} = require('node:fs');
const {
  createHmac,
} = require('node:crypto');
const { stdout } = require('node:process');

const hmac = createHmac('sha256', 'a secret');

const input = createReadStream('test.js');
input.pipe(hmac).pipe(stdout);
0 yang ditentukan. Jika
import { Buffer } from 'node:buffer';
const { randomFill } = await import('node:crypto');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});const { randomFill } = require('node:crypto');
const { Buffer } = require('node:buffer');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});
_2 tidak diberikan,
const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
00 diharapkan menjadi
import { createReadStream } from 'node:fs';
import { stdout } from 'node:process';
const {
  createHmac,
} = await import('node:crypto');

const hmac = createHmac('sha256', 'a secret');

const input = createReadStream('test.js');
input.pipe(hmac).pipe(stdout);const {
  createReadStream,
} = require('node:fs');
const {
  createHmac,
} = require('node:crypto');
const { stdout } = require('node:process');

const hmac = createHmac('sha256', 'a secret');

const input = createReadStream('test.js');
input.pipe(hmac).pipe(stdout);
3,
let crypto;
try {
  crypto = await import('node:crypto');
} catch (err) {
  console.error('crypto support is disabled!');
}
01, atau
let crypto;
try {
  crypto = await import('node:crypto');
} catch (err) {
  console.error('crypto support is disabled!');
}
02

Jika

import { createReadStream } from 'node:fs';
import { stdout } from 'node:process';
const {
  createHmac,
} = await import('node:crypto');

const hmac = createHmac('sha256', 'a secret');

const input = createReadStream('test.js');
input.pipe(hmac).pipe(stdout);const {
  createReadStream,
} = require('node:fs');
const {
  createHmac,
} = require('node:crypto');
const { stdout } = require('node:process');

const hmac = createHmac('sha256', 'a secret');

const input = createReadStream('test.js');
input.pipe(hmac).pipe(stdout);
_0 diberikan string akan dikembalikan;

const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
95 akan memunculkan kesalahan
const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
96 saat
const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
00 terletak di luar kurva elips. Karena
const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
_00 biasanya diberikan dari pengguna jarak jauh melalui jaringan yang tidak aman, pastikan untuk menangani pengecualian ini sesuai dengan itu

const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
_99

Menghasilkan nilai kunci Diffie-Hellman EC pribadi dan publik, dan mengembalikan kunci publik dalam

const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
65 dan
const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
11 yang ditentukan. Kunci ini harus ditransfer ke pihak lain

Argumen

const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
_65 menentukan penyandian titik dan dapat berupa
const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
67 atau
const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
68. Jika
const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
_65 tidak ditentukan, poin akan dikembalikan dalam format
const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
68

Jika

const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
_11 disediakan, sebuah string dikembalikan;

const { createDiffieHellmanGroup } = await import('node:crypto');
const dh = createDiffieHellmanGroup('modp16');const { createDiffieHellmanGroup } = require('node:crypto');
const dh = createDiffieHellmanGroup('modp16');
_09

Jika

const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
_11 ditentukan, sebuah string dikembalikan;

const { createDiffieHellmanGroup } = await import('node:crypto');
const dh = createDiffieHellmanGroup('modp16');const { createDiffieHellmanGroup } = require('node:crypto');
const dh = createDiffieHellmanGroup('modp16');
_12

Argumen

const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
_65 menentukan penyandian titik dan dapat berupa
const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
67 atau
const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
68. Jika
const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
_65 tidak ditentukan, poin akan dikembalikan dalam format
const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
68

Jika

const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
_11 ditentukan, sebuah string dikembalikan;

const { createDiffieHellmanGroup } = await import('node:crypto');
const dh = createDiffieHellmanGroup('modp16');const { createDiffieHellmanGroup } = require('node:crypto');
const dh = createDiffieHellmanGroup('modp16');
_20

Menetapkan kunci pribadi EC Diffie-Hellman. Jika

const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
_11 diberikan,
const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
32 diharapkan berupa string;

Jika

const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
_32 tidak valid untuk kurva yang ditentukan saat objek
const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
58 dibuat, kesalahan terjadi. Setelah menyetel kunci pribadi, titik (kunci) publik terkait juga dibuat dan disetel di objek
const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
58

const { createDiffieHellmanGroup } = await import('node:crypto');
const dh = createDiffieHellmanGroup('modp16');const { createDiffieHellmanGroup } = require('node:crypto');
const dh = createDiffieHellmanGroup('modp16');
_30

ditambahkan. v0. sebelas. 14 Tidak digunakan lagi sejak. v5. 2. 0

Menetapkan kunci publik EC Diffie-Hellman. Jika

const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
_11 disediakan
const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
40 diharapkan berupa string;

Biasanya tidak ada alasan untuk memanggil metode ini karena

const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
58 hanya memerlukan kunci privat dan kunci publik pihak lain untuk menghitung rahasia bersama. Biasanya baik atau akan dipanggil. Metode mencoba untuk menghasilkan titik/kunci publik yang terkait dengan kunci pribadi yang disetel

Contoh (memperoleh rahasia bersama)

kelas. const { createDiffieHellmanGroup } = await import('node:crypto'); const dh = createDiffieHellmanGroup('modp16');const { createDiffieHellmanGroup } = require('node:crypto'); const dh = createDiffieHellmanGroup('modp16');_40

Kelas _

const { createDiffieHellmanGroup } = await import('node:crypto');
const dh = createDiffieHellmanGroup('modp16');const { createDiffieHellmanGroup } = require('node:crypto');
const dh = createDiffieHellmanGroup('modp16');
_40 adalah utilitas untuk membuat ringkasan hash data. Ini dapat digunakan dengan salah satu dari dua cara

  • Sebagai aliran yang dapat dibaca dan ditulis, di mana data ditulis untuk menghasilkan intisari hash terkomputasi pada sisi yang dapat dibaca, atau
  • Menggunakan dan metode untuk menghasilkan hash yang dihitung

Metode ini digunakan untuk membuat

const { createDiffieHellmanGroup } = await import('node:crypto');
const dh = createDiffieHellmanGroup('modp16');const { createDiffieHellmanGroup } = require('node:crypto');
const dh = createDiffieHellmanGroup('modp16');
_40 instance.
const { createDiffieHellmanGroup } = await import('node:crypto');
const dh = createDiffieHellmanGroup('modp16');const { createDiffieHellmanGroup } = require('node:crypto');
const dh = createDiffieHellmanGroup('modp16');
_40 objek tidak boleh dibuat langsung menggunakan kata kunci
const { createDiffieHellmanGroup } = await import('node:crypto');
const dh = createDiffieHellmanGroup('modp16');const { createDiffieHellmanGroup } = require('node:crypto');
const dh = createDiffieHellmanGroup('modp16');
1

Contoh. Menggunakan

const { createDiffieHellmanGroup } = await import('node:crypto');
const dh = createDiffieHellmanGroup('modp16');const { createDiffieHellmanGroup } = require('node:crypto');
const dh = createDiffieHellmanGroup('modp16');
_40 objek sebagai aliran

Contoh. Menggunakan

const { createDiffieHellmanGroup } = await import('node:crypto');
const dh = createDiffieHellmanGroup('modp16');const { createDiffieHellmanGroup } = require('node:crypto');
const dh = createDiffieHellmanGroup('modp16');
_40 dan aliran pipa

import { createReadStream } from 'node:fs';
import { stdout } from 'node:process';
const { createHash } = await import('node:crypto');

const hash = createHash('sha256');

const input = createReadStream('test.js');
input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
const { createHash } = require('node:crypto');
const { stdout } = require('node:process');

const hash = createHash('sha256');

const input = createReadStream('test.js');
input.pipe(hash).setEncoding('hex').pipe(stdout);

Example. Using the and methods

const { createDiffieHellmanGroup } = await import('node:crypto');
const dh = createDiffieHellmanGroup('modp16');const { createDiffieHellmanGroup } = require('node:crypto');
const dh = createDiffieHellmanGroup('modp16');
_52

Membuat objek

const { createDiffieHellmanGroup } = await import('node:crypto');
const dh = createDiffieHellmanGroup('modp16');const { createDiffieHellmanGroup } = require('node:crypto');
const dh = createDiffieHellmanGroup('modp16');
_40 baru yang berisi salinan mendalam dari keadaan internal objek
const { createDiffieHellmanGroup } = await import('node:crypto');
const dh = createDiffieHellmanGroup('modp16');const { createDiffieHellmanGroup } = require('node:crypto');
const dh = createDiffieHellmanGroup('modp16');
40 saat ini

Argumen

let crypto;
try {
  crypto = await import('node:crypto');
} catch (err) {
  console.error('crypto support is disabled!');
}
_44 opsional mengontrol perilaku aliran. Untuk fungsi hash XOF seperti
const { createDiffieHellmanGroup } = await import('node:crypto');
const dh = createDiffieHellmanGroup('modp16');const { createDiffieHellmanGroup } = require('node:crypto');
const dh = createDiffieHellmanGroup('modp16');
56, opsi
const { createDiffieHellmanGroup } = await import('node:crypto');
const dh = createDiffieHellmanGroup('modp16');const { createDiffieHellmanGroup } = require('node:crypto');
const dh = createDiffieHellmanGroup('modp16');
57 dapat digunakan untuk menentukan panjang output yang diinginkan dalam byte

Kesalahan dilemparkan ketika upaya dilakukan untuk menyalin objek

const { createDiffieHellmanGroup } = await import('node:crypto');
const dh = createDiffieHellmanGroup('modp16');const { createDiffieHellmanGroup } = require('node:crypto');
const dh = createDiffieHellmanGroup('modp16');
40 setelah metodenya dipanggil

const { createDiffieHellmanGroup } = await import('node:crypto');
const dh = createDiffieHellmanGroup('modp16');const { createDiffieHellmanGroup } = require('node:crypto');
const dh = createDiffieHellmanGroup('modp16');
_60

Menghitung intisari dari semua data yang diteruskan ke hash (menggunakan metode ini). Jika

const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
_11 disediakan, sebuah string akan dikembalikan;

Objek

const { createDiffieHellmanGroup } = await import('node:crypto');
const dh = createDiffieHellmanGroup('modp16');const { createDiffieHellmanGroup } = require('node:crypto');
const dh = createDiffieHellmanGroup('modp16');
40 tidak dapat digunakan lagi setelah metode
const { createDiffieHellmanGroup } = await import('node:crypto');
const dh = createDiffieHellmanGroup('modp16');const { createDiffieHellmanGroup } = require('node:crypto');
const dh = createDiffieHellmanGroup('modp16');
43 dipanggil. Beberapa panggilan akan menyebabkan kesalahan terjadi

const { createDiffieHellmanGroup } = await import('node:crypto');
const dh = createDiffieHellmanGroup('modp16');const { createDiffieHellmanGroup } = require('node:crypto');
const dh = createDiffieHellmanGroup('modp16');
_66

HistoryVersionChangesv6. 0. 0

import { Buffer } from 'node:buffer';
const { randomFill } = await import('node:crypto');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});const { randomFill } = require('node:crypto');
const { Buffer } = require('node:buffer');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});
2 default diubah dari
import { Buffer } from 'node:buffer';
const { randomFill } = await import('node:crypto');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});const { randomFill } = require('node:crypto');
const { Buffer } = require('node:buffer');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});
3 menjadi
import { Buffer } from 'node:buffer';
const { randomFill } = await import('node:crypto');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});const { randomFill } = require('node:crypto');
const { Buffer } = require('node:buffer');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});
4

v0. 1. 92

ditambahkan. v0. 1. 92

Memperbarui konten hash dengan

import { Buffer } from 'node:buffer';
const { randomFill } = await import('node:crypto');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});const { randomFill } = require('node:crypto');
const { Buffer } = require('node:buffer');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});
5 yang diberikan, yang penyandiannya diberikan dalam
import { Buffer } from 'node:buffer';
const { randomFill } = await import('node:crypto');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});const { randomFill } = require('node:crypto');
const { Buffer } = require('node:buffer');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});
2. Jika
const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
_11 tidak disediakan, dan
import { Buffer } from 'node:buffer';
const { randomFill } = await import('node:crypto');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});const { randomFill } = require('node:crypto');
const { Buffer } = require('node:buffer');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});
5 adalah string, penyandian
const { createDiffieHellmanGroup } = await import('node:crypto');
const dh = createDiffieHellmanGroup('modp16');const { createDiffieHellmanGroup } = require('node:crypto');
const dh = createDiffieHellmanGroup('modp16');
74 diterapkan. Jika
import { Buffer } from 'node:buffer';
const { randomFill } = await import('node:crypto');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});const { randomFill } = require('node:crypto');
const { Buffer } = require('node:buffer');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});
_5 adalah
import { createReadStream } from 'node:fs';
import { stdout } from 'node:process';
const {
  createHmac,
} = await import('node:crypto');

const hmac = createHmac('sha256', 'a secret');

const input = createReadStream('test.js');
input.pipe(hmac).pipe(stdout);const {
  createReadStream,
} = require('node:fs');
const {
  createHmac,
} = require('node:crypto');
const { stdout } = require('node:process');

const hmac = createHmac('sha256', 'a secret');

const input = createReadStream('test.js');
input.pipe(hmac).pipe(stdout);
3,
let crypto;
try {
  crypto = await import('node:crypto');
} catch (err) {
  console.error('crypto support is disabled!');
}
01, atau
let crypto;
try {
  crypto = await import('node:crypto');
} catch (err) {
  console.error('crypto support is disabled!');
}
02, maka
import { Buffer } from 'node:buffer';
const { randomFill } = await import('node:crypto');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});const { randomFill } = require('node:crypto');
const { Buffer } = require('node:buffer');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});
2 diabaikan

Ini dapat dipanggil berkali-kali dengan data baru saat dialirkan

kelas. const { createDiffieHellmanGroup } = await import('node:crypto'); const dh = createDiffieHellmanGroup('modp16');const { createDiffieHellmanGroup } = require('node:crypto'); const dh = createDiffieHellmanGroup('modp16');_80

Kelas

const { createDiffieHellmanGroup } = await import('node:crypto');
const dh = createDiffieHellmanGroup('modp16');const { createDiffieHellmanGroup } = require('node:crypto');
const dh = createDiffieHellmanGroup('modp16');
_80 adalah utilitas untuk membuat intisari HMAC kriptografis. Ini dapat digunakan dengan salah satu dari dua cara

  • Sebagai aliran yang dapat dibaca dan ditulis, di mana data ditulis untuk menghasilkan intisari HMAC yang dihitung pada sisi yang dapat dibaca, atau
  • Menggunakan dan metode untuk menghasilkan intisari HMAC yang dihitung

Metode ini digunakan untuk membuat

const { createDiffieHellmanGroup } = await import('node:crypto');
const dh = createDiffieHellmanGroup('modp16');const { createDiffieHellmanGroup } = require('node:crypto');
const dh = createDiffieHellmanGroup('modp16');
_80 instance.
const { createDiffieHellmanGroup } = await import('node:crypto');
const dh = createDiffieHellmanGroup('modp16');const { createDiffieHellmanGroup } = require('node:crypto');
const dh = createDiffieHellmanGroup('modp16');
_80 objek tidak boleh dibuat langsung menggunakan kata kunci
const { createDiffieHellmanGroup } = await import('node:crypto');
const dh = createDiffieHellmanGroup('modp16');const { createDiffieHellmanGroup } = require('node:crypto');
const dh = createDiffieHellmanGroup('modp16');
1

Contoh. Menggunakan

const { createDiffieHellmanGroup } = await import('node:crypto');
const dh = createDiffieHellmanGroup('modp16');const { createDiffieHellmanGroup } = require('node:crypto');
const dh = createDiffieHellmanGroup('modp16');
_80 objek sebagai aliran

Contoh. Menggunakan

const { createDiffieHellmanGroup } = await import('node:crypto');
const dh = createDiffieHellmanGroup('modp16');const { createDiffieHellmanGroup } = require('node:crypto');
const dh = createDiffieHellmanGroup('modp16');
_80 dan aliran pipa

import { createReadStream } from 'node:fs';
import { stdout } from 'node:process';
const {
  createHmac,
} = await import('node:crypto');

const hmac = createHmac('sha256', 'a secret');

const input = createReadStream('test.js');
input.pipe(hmac).pipe(stdout);const {
  createReadStream,
} = require('node:fs');
const {
  createHmac,
} = require('node:crypto');
const { stdout } = require('node:process');

const hmac = createHmac('sha256', 'a secret');

const input = createReadStream('test.js');
input.pipe(hmac).pipe(stdout);

Example. Using the and methods

const { createDiffieHellmanGroup } = await import('node:crypto');
const dh = createDiffieHellmanGroup('modp16');const { createDiffieHellmanGroup } = require('node:crypto');
const dh = createDiffieHellmanGroup('modp16');
_92

Menghitung ringkasan HMAC dari semua data yang dikirimkan menggunakan. Jika

const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
_11 disediakan, sebuah string dikembalikan;

Objek

const { createDiffieHellmanGroup } = await import('node:crypto');
const dh = createDiffieHellmanGroup('modp16');const { createDiffieHellmanGroup } = require('node:crypto');
const dh = createDiffieHellmanGroup('modp16');
_80 tidak dapat digunakan lagi setelah
const { createDiffieHellmanGroup } = await import('node:crypto');
const dh = createDiffieHellmanGroup('modp16');const { createDiffieHellmanGroup } = require('node:crypto');
const dh = createDiffieHellmanGroup('modp16');
83 dipanggil. Beberapa panggilan ke
const { createDiffieHellmanGroup } = await import('node:crypto');
const dh = createDiffieHellmanGroup('modp16');const { createDiffieHellmanGroup } = require('node:crypto');
const dh = createDiffieHellmanGroup('modp16');
_83 akan mengakibatkan kesalahan dilemparkan

const { createDiffieHellmanGroup } = await import('node:crypto');
const dh = createDiffieHellmanGroup('modp16');const { createDiffieHellmanGroup } = require('node:crypto');
const dh = createDiffieHellmanGroup('modp16');
_99

HistoryVersionChangesv6. 0. 0

import { Buffer } from 'node:buffer';
const { randomFill } = await import('node:crypto');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});const { randomFill } = require('node:crypto');
const { Buffer } = require('node:buffer');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});
2 default diubah dari
import { Buffer } from 'node:buffer';
const { randomFill } = await import('node:crypto');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});const { randomFill } = require('node:crypto');
const { Buffer } = require('node:buffer');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});
3 menjadi
import { Buffer } from 'node:buffer';
const { randomFill } = await import('node:crypto');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});const { randomFill } = require('node:crypto');
const { Buffer } = require('node:buffer');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});
4

v0. 1. 94

ditambahkan. v0. 1. 94

Memperbarui konten

const { createDiffieHellmanGroup } = await import('node:crypto');
const dh = createDiffieHellmanGroup('modp16');const { createDiffieHellmanGroup } = require('node:crypto');
const dh = createDiffieHellmanGroup('modp16');
_80 dengan
import { Buffer } from 'node:buffer';
const { randomFill } = await import('node:crypto');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});const { randomFill } = require('node:crypto');
const { Buffer } = require('node:buffer');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});
5 yang diberikan, yang penyandiannya diberikan dalam
import { Buffer } from 'node:buffer';
const { randomFill } = await import('node:crypto');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});const { randomFill } = require('node:crypto');
const { Buffer } = require('node:buffer');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});
2. Jika
const { Certificate } = await import('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();const { Certificate } = require('node:crypto');

const cert1 = new Certificate();
const cert2 = Certificate();
_11 tidak disediakan, dan
import { Buffer } from 'node:buffer';
const { randomFill } = await import('node:crypto');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});const { randomFill } = require('node:crypto');
const { Buffer } = require('node:buffer');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});
5 adalah string, penyandian
const { createDiffieHellmanGroup } = await import('node:crypto');
const dh = createDiffieHellmanGroup('modp16');const { createDiffieHellmanGroup } = require('node:crypto');
const dh = createDiffieHellmanGroup('modp16');
74 diterapkan. Jika
import { Buffer } from 'node:buffer';
const { randomFill } = await import('node:crypto');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});const { randomFill } = require('node:crypto');
const { Buffer } = require('node:buffer');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});
_5 adalah
import { createReadStream } from 'node:fs';
import { stdout } from 'node:process';
const {
  createHmac,
} = await import('node:crypto');

const hmac = createHmac('sha256', 'a secret');

const input = createReadStream('test.js');
input.pipe(hmac).pipe(stdout);const {
  createReadStream,
} = require('node:fs');
const {
  createHmac,
} = require('node:crypto');
const { stdout } = require('node:process');

const hmac = createHmac('sha256', 'a secret');

const input = createReadStream('test.js');
input.pipe(hmac).pipe(stdout);
3,
let crypto;
try {
  crypto = await import('node:crypto');
} catch (err) {
  console.error('crypto support is disabled!');
}
01, atau
let crypto;
try {
  crypto = await import('node:crypto');
} catch (err) {
  console.error('crypto support is disabled!');
}
02, maka
import { Buffer } from 'node:buffer';
const { randomFill } = await import('node:crypto');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});const { randomFill } = require('node:crypto');
const { Buffer } = require('node:buffer');

const a = new Uint32Array(10);
randomFill(a, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const b = new DataView(new ArrayBuffer(10));
randomFill(b, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
    .toString('hex'));
});

const c = new ArrayBuffer(10);
randomFill(c, (err, buf) => {
  if (err) throw err;
  console.log(Buffer.from(buf).toString('hex'));
});
2 diabaikan

Ini dapat dipanggil berkali-kali dengan data baru saat dialirkan

kelas. import { createReadStream } from 'node:fs'; import { stdout } from 'node:process'; const { createHash } = await import('node:crypto'); const hash = createHash('sha256'); const input = createReadStream('test.js'); input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs'); const { createHash } = require('node:crypto'); const { stdout } = require('node:process'); const hash = createHash('sha256'); const input = createReadStream('test.js'); input.pipe(hash).setEncoding('hex').pipe(stdout);_14

HistoryVersionChangesv14. 5. 0.v12. 19. 0

Instance kelas ini sekarang dapat diteruskan ke utas pekerja menggunakan

import { createReadStream } from 'node:fs';
import { stdout } from 'node:process';
const { createHash } = await import('node:crypto');

const hash = createHash('sha256');

const input = createReadStream('test.js');
input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
const { createHash } = require('node:crypto');
const { stdout } = require('node:process');

const hash = createHash('sha256');

const input = createReadStream('test.js');
input.pipe(hash).setEncoding('hex').pipe(stdout);
15

v11. 13. 0

Kelas ini sekarang diekspor

v11. 6. 0

ditambahkan. v11. 6. 0

Jangan berikan. js menggunakan kelas

import { createReadStream } from 'node:fs';
import { stdout } from 'node:process';
const { createHash } = await import('node:crypto');

const hash = createHash('sha256');

const input = createReadStream('test.js');
input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
const { createHash } = require('node:crypto');
const { stdout } = require('node:process');

const hash = createHash('sha256');

const input = createReadStream('test.js');
input.pipe(hash).setEncoding('hex').pipe(stdout);
14 untuk mewakili kunci simetris atau asimetris, dan setiap jenis kunci memperlihatkan fungsi yang berbeda. Metode , dan digunakan untuk membuat ________36______14 instance.
import { createReadStream } from 'node:fs';
import { stdout } from 'node:process';
const { createHash } = await import('node:crypto');

const hash = createHash('sha256');

const input = createReadStream('test.js');
input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
const { createHash } = require('node:crypto');
const { stdout } = require('node:process');

const hash = createHash('sha256');

const input = createReadStream('test.js');
input.pipe(hash).setEncoding('hex').pipe(stdout);
_14 objek tidak boleh dibuat langsung menggunakan kata kunci
const { createDiffieHellmanGroup } = await import('node:crypto');
const dh = createDiffieHellmanGroup('modp16');const { createDiffieHellmanGroup } = require('node:crypto');
const dh = createDiffieHellmanGroup('modp16');
1

Sebagian besar aplikasi harus mempertimbangkan untuk menggunakan

import { createReadStream } from 'node:fs';
import { stdout } from 'node:process';
const { createHash } = await import('node:crypto');

const hash = createHash('sha256');

const input = createReadStream('test.js');
input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
const { createHash } = require('node:crypto');
const { stdout } = require('node:process');

const hash = createHash('sha256');

const input = createReadStream('test.js');
input.pipe(hash).setEncoding('hex').pipe(stdout);
14 API baru alih-alih meneruskan kunci sebagai string atau
import { createReadStream } from 'node:fs';
import { stdout } from 'node:process';
const {
  createHmac,
} = await import('node:crypto');

const hmac = createHmac('sha256', 'a secret');

const input = createReadStream('test.js');
input.pipe(hmac).pipe(stdout);const {
  createReadStream,
} = require('node:fs');
const {
  createHmac,
} = require('node:crypto');
const { stdout } = require('node:process');

const hmac = createHmac('sha256', 'a secret');

const input = createReadStream('test.js');
input.pipe(hmac).pipe(stdout);
3s karena fitur keamanan yang ditingkatkan

import { createReadStream } from 'node:fs';
import { stdout } from 'node:process';
const { createHash } = await import('node:crypto');

const hash = createHash('sha256');

const input = createReadStream('test.js');
input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
const { createHash } = require('node:crypto');
const { stdout } = require('node:process');

const hash = createHash('sha256');

const input = createReadStream('test.js');
input.pipe(hash).setEncoding('hex').pipe(stdout);
_14 instance dapat diteruskan ke utas lainnya melalui. Penerima mendapatkan kloning
import { createReadStream } from 'node:fs';
import { stdout } from 'node:process';
const { createHash } = await import('node:crypto');

const hash = createHash('sha256');

const input = createReadStream('test.js');
input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
const { createHash } = require('node:crypto');
const { stdout } = require('node:process');

const hash = createHash('sha256');

const input = createReadStream('test.js');
input.pipe(hash).setEncoding('hex').pipe(stdout);
_14, dan
import { createReadStream } from 'node:fs';
import { stdout } from 'node:process';
const { createHash } = await import('node:crypto');

const hash = createHash('sha256');

const input = createReadStream('test.js');
input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
const { createHash } = require('node:crypto');
const { stdout } = require('node:process');

const hash = createHash('sha256');

const input = createReadStream('test.js');
input.pipe(hash).setEncoding('hex').pipe(stdout);
14 tidak perlu dicantumkan dalam argumen
import { createReadStream } from 'node:fs';
import { stdout } from 'node:process';
const { createHash } = await import('node:crypto');

const hash = createHash('sha256');

const input = createReadStream('test.js');
input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
const { createHash } = require('node:crypto');
const { stdout } = require('node:process');

const hash = createHash('sha256');

const input = createReadStream('test.js');
input.pipe(hash).setEncoding('hex').pipe(stdout);
29

Metode statis.
import { createReadStream } from 'node:fs';
import { stdout } from 'node:process';
const { createHash } = await import('node:crypto');

const hash = createHash('sha256');

const input = createReadStream('test.js');
input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
const { createHash } = require('node:crypto');
const { stdout } = require('node:process');

const hash = createHash('sha256');

const input = createReadStream('test.js');
input.pipe(hash).setEncoding('hex').pipe(stdout);
_30

Contoh. Mengonversi instance

import { createReadStream } from 'node:fs';
import { stdout } from 'node:process';
const { createHash } = await import('node:crypto');

const hash = createHash('sha256');

const input = createReadStream('test.js');
input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
const { createHash } = require('node:crypto');
const { stdout } = require('node:process');

const hash = createHash('sha256');

const input = createReadStream('test.js');
input.pipe(hash).setEncoding('hex').pipe(stdout);
_31 menjadi
import { createReadStream } from 'node:fs';
import { stdout } from 'node:process';
const { createHash } = await import('node:crypto');

const hash = createHash('sha256');

const input = createReadStream('test.js');
input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
const { createHash } = require('node:crypto');
const { stdout } = require('node:process');

const hash = createHash('sha256');

const input = createReadStream('test.js');
input.pipe(hash).setEncoding('hex').pipe(stdout);
14

import { createReadStream } from 'node:fs';
import { stdout } from 'node:process';
const { createHash } = await import('node:crypto');

const hash = createHash('sha256');

const input = createReadStream('test.js');
input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
const { createHash } = require('node:crypto');
const { stdout } = require('node:process');

const hash = createHash('sha256');

const input = createReadStream('test.js');
input.pipe(hash).setEncoding('hex').pipe(stdout);
_33

HistoryVersionChangesv16. 9. 0

Ekspos parameter urutan

import { createReadStream } from 'node:fs';
import { stdout } from 'node:process';
const { createHash } = await import('node:crypto');

const hash = createHash('sha256');

const input = createReadStream('test.js');
input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
const { createHash } = require('node:crypto');
const { stdout } = require('node:process');

const hash = createHash('sha256');

const input = createReadStream('test.js');
input.pipe(hash).setEncoding('hex').pipe(stdout);
34 untuk kunci RSA-PSS

v15. 7. 0

ditambahkan. v15. 7. 0

    • import { createReadStream } from 'node:fs';
      import { stdout } from 'node:process';
      const { createHash } = await import('node:crypto');
      
      const hash = createHash('sha256');
      
      const input = createReadStream('test.js');
      input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
      const { createHash } = require('node:crypto');
      const { stdout } = require('node:process');
      
      const hash = createHash('sha256');
      
      const input = createReadStream('test.js');
      input.pipe(hash).setEncoding('hex').pipe(stdout);
      _35. Ukuran kunci dalam bit (RSA, DSA)
    • import { createReadStream } from 'node:fs';
      import { stdout } from 'node:process';
      const { createHash } = await import('node:crypto');
      
      const hash = createHash('sha256');
      
      const input = createReadStream('test.js');
      input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
      const { createHash } = require('node:crypto');
      const { stdout } = require('node:process');
      
      const hash = createHash('sha256');
      
      const input = createReadStream('test.js');
      input.pipe(hash).setEncoding('hex').pipe(stdout);
      _36. eksponen publik (RSA)
    • import { createReadStream } from 'node:fs';
      import { stdout } from 'node:process';
      const { createHash } = await import('node:crypto');
      
      const hash = createHash('sha256');
      
      const input = createReadStream('test.js');
      input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
      const { createHash } = require('node:crypto');
      const { stdout } = require('node:process');
      
      const hash = createHash('sha256');
      
      const input = createReadStream('test.js');
      input.pipe(hash).setEncoding('hex').pipe(stdout);
      _37. Nama intisari pesan (RSA-PSS)
    • import { createReadStream } from 'node:fs';
      import { stdout } from 'node:process';
      const { createHash } = await import('node:crypto');
      
      const hash = createHash('sha256');
      
      const input = createReadStream('test.js');
      input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
      const { createHash } = require('node:crypto');
      const { stdout } = require('node:process');
      
      const hash = createHash('sha256');
      
      const input = createReadStream('test.js');
      input.pipe(hash).setEncoding('hex').pipe(stdout);
      _38. Nama intisari pesan yang digunakan oleh MGF1 (RSA-PSS)
    • import { createReadStream } from 'node:fs';
      import { stdout } from 'node:process';
      const { createHash } = await import('node:crypto');
      
      const hash = createHash('sha256');
      
      const input = createReadStream('test.js');
      input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
      const { createHash } = require('node:crypto');
      const { stdout } = require('node:process');
      
      const hash = createHash('sha256');
      
      const input = createReadStream('test.js');
      input.pipe(hash).setEncoding('hex').pipe(stdout);
      _39. Panjang garam minimal dalam byte (RSA-PSS)
    • import { createReadStream } from 'node:fs';
      import { stdout } from 'node:process';
      const { createHash } = await import('node:crypto');
      
      const hash = createHash('sha256');
      
      const input = createReadStream('test.js');
      input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
      const { createHash } = require('node:crypto');
      const { stdout } = require('node:process');
      
      const hash = createHash('sha256');
      
      const input = createReadStream('test.js');
      input.pipe(hash).setEncoding('hex').pipe(stdout);
      _40. Ukuran
      import { createReadStream } from 'node:fs';
      import { stdout } from 'node:process';
      const { createHash } = await import('node:crypto');
      
      const hash = createHash('sha256');
      
      const input = createReadStream('test.js');
      input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
      const { createHash } = require('node:crypto');
      const { stdout } = require('node:process');
      
      const hash = createHash('sha256');
      
      const input = createReadStream('test.js');
      input.pipe(hash).setEncoding('hex').pipe(stdout);
      41 dalam bit (DSA)
    • import { createReadStream } from 'node:fs';
      import { stdout } from 'node:process';
      const { createHash } = await import('node:crypto');
      
      const hash = createHash('sha256');
      
      const input = createReadStream('test.js');
      input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
      const { createHash } = require('node:crypto');
      const { stdout } = require('node:process');
      
      const hash = createHash('sha256');
      
      const input = createReadStream('test.js');
      input.pipe(hash).setEncoding('hex').pipe(stdout);
      _42. Nama kurva (EC)

    Properti ini hanya ada pada kunci asimetris. Bergantung pada jenis kuncinya, objek ini berisi informasi tentang kuncinya. Tidak ada informasi yang diperoleh melalui properti ini yang dapat digunakan untuk mengidentifikasi kunci secara unik atau membahayakan keamanan kunci

    Untuk kunci RSA-PSS, jika materi kunci berisi urutan

    import { createReadStream } from 'node:fs';
    import { stdout } from 'node:process';
    const { createHash } = await import('node:crypto');
    
    const hash = createHash('sha256');
    
    const input = createReadStream('test.js');
    input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
    const { createHash } = require('node:crypto');
    const { stdout } = require('node:process');
    
    const hash = createHash('sha256');
    
    const input = createReadStream('test.js');
    input.pipe(hash).setEncoding('hex').pipe(stdout);
    34, properti
    import { createReadStream } from 'node:fs';
    import { stdout } from 'node:process';
    const { createHash } = await import('node:crypto');
    
    const hash = createHash('sha256');
    
    const input = createReadStream('test.js');
    input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
    const { createHash } = require('node:crypto');
    const { stdout } = require('node:process');
    
    const hash = createHash('sha256');
    
    const input = createReadStream('test.js');
    input.pipe(hash).setEncoding('hex').pipe(stdout);
    37,
    import { createReadStream } from 'node:fs';
    import { stdout } from 'node:process';
    const { createHash } = await import('node:crypto');
    
    const hash = createHash('sha256');
    
    const input = createReadStream('test.js');
    input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
    const { createHash } = require('node:crypto');
    const { stdout } = require('node:process');
    
    const hash = createHash('sha256');
    
    const input = createReadStream('test.js');
    input.pipe(hash).setEncoding('hex').pipe(stdout);
    38, dan
    import { createReadStream } from 'node:fs';
    import { stdout } from 'node:process';
    const { createHash } = await import('node:crypto');
    
    const hash = createHash('sha256');
    
    const input = createReadStream('test.js');
    input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
    const { createHash } = require('node:crypto');
    const { stdout } = require('node:process');
    
    const hash = createHash('sha256');
    
    const input = createReadStream('test.js');
    input.pipe(hash).setEncoding('hex').pipe(stdout);
    39 akan ditetapkan

    Detail kunci lainnya mungkin diekspos melalui API ini menggunakan atribut tambahan

    import { createReadStream } from 'node:fs';
    import { stdout } from 'node:process';
    const { createHash } = await import('node:crypto');
    
    const hash = createHash('sha256');
    
    const input = createReadStream('test.js');
    input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
    const { createHash } = require('node:crypto');
    const { stdout } = require('node:process');
    
    const hash = createHash('sha256');
    
    const input = createReadStream('test.js');
    input.pipe(hash).setEncoding('hex').pipe(stdout);
    _47

    HistoryVersionChangesv13. 9. 0.v12. 17. 0

    Menambahkan dukungan untuk

    import { createReadStream } from 'node:fs';
    import { stdout } from 'node:process';
    const { createHash } = await import('node:crypto');
    
    const hash = createHash('sha256');
    
    const input = createReadStream('test.js');
    input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
    const { createHash } = require('node:crypto');
    const { stdout } = require('node:process');
    
    const hash = createHash('sha256');
    
    const input = createReadStream('test.js');
    input.pipe(hash).setEncoding('hex').pipe(stdout);
    _48

    v12. 0. 0

    Menambahkan dukungan untuk

    import { createReadStream } from 'node:fs';
    import { stdout } from 'node:process';
    const { createHash } = await import('node:crypto');
    
    const hash = createHash('sha256');
    
    const input = createReadStream('test.js');
    input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
    const { createHash } = require('node:crypto');
    const { stdout } = require('node:process');
    
    const hash = createHash('sha256');
    
    const input = createReadStream('test.js');
    input.pipe(hash).setEncoding('hex').pipe(stdout);
    _49

    v12. 0. 0

    Properti ini sekarang mengembalikan

    import { createReadStream } from 'node:fs';
    import { stdout } from 'node:process';
    const { createHash } = await import('node:crypto');
    
    const hash = createHash('sha256');
    
    const input = createReadStream('test.js');
    input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
    const { createHash } = require('node:crypto');
    const { stdout } = require('node:process');
    
    const hash = createHash('sha256');
    
    const input = createReadStream('test.js');
    input.pipe(hash).setEncoding('hex').pipe(stdout);
    50 untuk instance KeyObject dari jenis yang tidak dikenal alih-alih dibatalkan

    v12. 0. 0

    Menambahkan dukungan untuk

    import { createReadStream } from 'node:fs';
    import { stdout } from 'node:process';
    const { createHash } = await import('node:crypto');
    
    const hash = createHash('sha256');
    
    const input = createReadStream('test.js');
    input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
    const { createHash } = require('node:crypto');
    const { stdout } = require('node:process');
    
    const hash = createHash('sha256');
    
    const input = createReadStream('test.js');
    input.pipe(hash).setEncoding('hex').pipe(stdout);
    51 dan
    import { createReadStream } from 'node:fs';
    import { stdout } from 'node:process';
    const { createHash } = await import('node:crypto');
    
    const hash = createHash('sha256');
    
    const input = createReadStream('test.js');
    input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
    const { createHash } = require('node:crypto');
    const { stdout } = require('node:process');
    
    const hash = createHash('sha256');
    
    const input = createReadStream('test.js');
    input.pipe(hash).setEncoding('hex').pipe(stdout);
    52

    v12. 0. 0

    Menambahkan dukungan untuk

    import { createReadStream } from 'node:fs';
    import { stdout } from 'node:process';
    const { createHash } = await import('node:crypto');
    
    const hash = createHash('sha256');
    
    const input = createReadStream('test.js');
    input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
    const { createHash } = require('node:crypto');
    const { stdout } = require('node:process');
    
    const hash = createHash('sha256');
    
    const input = createReadStream('test.js');
    input.pipe(hash).setEncoding('hex').pipe(stdout);
    53 dan
    import { createReadStream } from 'node:fs';
    import { stdout } from 'node:process';
    const { createHash } = await import('node:crypto');
    
    const hash = createHash('sha256');
    
    const input = createReadStream('test.js');
    input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
    const { createHash } = require('node:crypto');
    const { stdout } = require('node:process');
    
    const hash = createHash('sha256');
    
    const input = createReadStream('test.js');
    input.pipe(hash).setEncoding('hex').pipe(stdout);
    54

    v11. 6. 0

    ditambahkan. v11. 6. 0

    Untuk kunci asimetris, properti ini mewakili jenis kunci. Jenis kunci yang didukung adalah

    • import { createReadStream } from 'node:fs';
      import { stdout } from 'node:process';
      const { createHash } = await import('node:crypto');
      
      const hash = createHash('sha256');
      
      const input = createReadStream('test.js');
      input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
      const { createHash } = require('node:crypto');
      const { stdout } = require('node:process');
      
      const hash = createHash('sha256');
      
      const input = createReadStream('test.js');
      input.pipe(hash).setEncoding('hex').pipe(stdout);
      55 (OID 1. 2. 840. 113549. 1. 1. satu)
    • import { createReadStream } from 'node:fs';
      import { stdout } from 'node:process';
      const { createHash } = await import('node:crypto');
      
      const hash = createHash('sha256');
      
      const input = createReadStream('test.js');
      input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
      const { createHash } = require('node:crypto');
      const { stdout } = require('node:process');
      
      const hash = createHash('sha256');
      
      const input = createReadStream('test.js');
      input.pipe(hash).setEncoding('hex').pipe(stdout);
      49 (OID 1. 2. 840. 113549. 1. 1. 10)
    • import { createReadStream } from 'node:fs';
      import { stdout } from 'node:process';
      const { createHash } = await import('node:crypto');
      
      const hash = createHash('sha256');
      
      const input = createReadStream('test.js');
      input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
      const { createHash } = require('node:crypto');
      const { stdout } = require('node:process');
      
      const hash = createHash('sha256');
      
      const input = createReadStream('test.js');
      input.pipe(hash).setEncoding('hex').pipe(stdout);
      57 (OID 1. 2. 840. 10040. 4. satu)
    • import { createReadStream } from 'node:fs';
      import { stdout } from 'node:process';
      const { createHash } = await import('node:crypto');
      
      const hash = createHash('sha256');
      
      const input = createReadStream('test.js');
      input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
      const { createHash } = require('node:crypto');
      const { stdout } = require('node:process');
      
      const hash = createHash('sha256');
      
      const input = createReadStream('test.js');
      input.pipe(hash).setEncoding('hex').pipe(stdout);
      58 (OID 1. 2. 840. 10045. 2. satu)
    • import { createReadStream } from 'node:fs';
      import { stdout } from 'node:process';
      const { createHash } = await import('node:crypto');
      
      const hash = createHash('sha256');
      
      const input = createReadStream('test.js');
      input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
      const { createHash } = require('node:crypto');
      const { stdout } = require('node:process');
      
      const hash = createHash('sha256');
      
      const input = createReadStream('test.js');
      input.pipe(hash).setEncoding('hex').pipe(stdout);
      51 (OID 1. 3. 101. 110)
    • import { createReadStream } from 'node:fs';
      import { stdout } from 'node:process';
      const { createHash } = await import('node:crypto');
      
      const hash = createHash('sha256');
      
      const input = createReadStream('test.js');
      input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
      const { createHash } = require('node:crypto');
      const { stdout } = require('node:process');
      
      const hash = createHash('sha256');
      
      const input = createReadStream('test.js');
      input.pipe(hash).setEncoding('hex').pipe(stdout);
      52 (OID 1. 3. 101. 111)
    • import { createReadStream } from 'node:fs';
      import { stdout } from 'node:process';
      const { createHash } = await import('node:crypto');
      
      const hash = createHash('sha256');
      
      const input = createReadStream('test.js');
      input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
      const { createHash } = require('node:crypto');
      const { stdout } = require('node:process');
      
      const hash = createHash('sha256');
      
      const input = createReadStream('test.js');
      input.pipe(hash).setEncoding('hex').pipe(stdout);
      53 (OID 1. 3. 101. 112)
    • import { createReadStream } from 'node:fs';
      import { stdout } from 'node:process';
      const { createHash } = await import('node:crypto');
      
      const hash = createHash('sha256');
      
      const input = createReadStream('test.js');
      input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
      const { createHash } = require('node:crypto');
      const { stdout } = require('node:process');
      
      const hash = createHash('sha256');
      
      const input = createReadStream('test.js');
      input.pipe(hash).setEncoding('hex').pipe(stdout);
      54 (OID 1. 3. 101. 113)
    • import { createReadStream } from 'node:fs';
      import { stdout } from 'node:process';
      const { createHash } = await import('node:crypto');
      
      const hash = createHash('sha256');
      
      const input = createReadStream('test.js');
      input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
      const { createHash } = require('node:crypto');
      const { stdout } = require('node:process');
      
      const hash = createHash('sha256');
      
      const input = createReadStream('test.js');
      input.pipe(hash).setEncoding('hex').pipe(stdout);
      48 (OID 1. 2. 840. 113549. 1. 3. satu)

    Properti ini adalah

    import { createReadStream } from 'node:fs';
    import { stdout } from 'node:process';
    const { createHash } = await import('node:crypto');
    
    const hash = createHash('sha256');
    
    const input = createReadStream('test.js');
    input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
    const { createHash } = require('node:crypto');
    const { stdout } = require('node:process');
    
    const hash = createHash('sha256');
    
    const input = createReadStream('test.js');
    input.pipe(hash).setEncoding('hex').pipe(stdout);
    50 untuk jenis
    import { createReadStream } from 'node:fs';
    import { stdout } from 'node:process';
    const { createHash } = await import('node:crypto');
    
    const hash = createHash('sha256');
    
    const input = createReadStream('test.js');
    input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
    const { createHash } = require('node:crypto');
    const { stdout } = require('node:process');
    
    const hash = createHash('sha256');
    
    const input = createReadStream('test.js');
    input.pipe(hash).setEncoding('hex').pipe(stdout);
    _14 yang tidak dikenal dan kunci simetris

    import { createReadStream } from 'node:fs';
    import { stdout } from 'node:process';
    const { createHash } = await import('node:crypto');
    
    const hash = createHash('sha256');
    
    const input = createReadStream('test.js');
    input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
    const { createHash } = require('node:crypto');
    const { stdout } = require('node:process');
    
    const hash = createHash('sha256');
    
    const input = createReadStream('test.js');
    input.pipe(hash).setEncoding('hex').pipe(stdout);
    _66

    HistoryVersionChangesv15. 9. 0

    Menambahkan dukungan untuk format

    import { createReadStream } from 'node:fs';
    import { stdout } from 'node:process';
    const { createHash } = await import('node:crypto');
    
    const hash = createHash('sha256');
    
    const input = createReadStream('test.js');
    input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
    const { createHash } = require('node:crypto');
    const { stdout } = require('node:process');
    
    const hash = createHash('sha256');
    
    const input = createReadStream('test.js');
    input.pipe(hash).setEncoding('hex').pipe(stdout);
    _67

    v11. 6. 0

    ditambahkan. v11. 6. 0

    Untuk kunci simetris, opsi penyandian berikut dapat digunakan

    • const { Certificate } = await import('node:crypto');
      
      const cert1 = new Certificate();
      const cert2 = Certificate();const { Certificate } = require('node:crypto');
      
      const cert1 = new Certificate();
      const cert2 = Certificate();
      65. Must be
      import { createReadStream } from 'node:fs';
      import { stdout } from 'node:process';
      const { createHash } = await import('node:crypto');
      
      const hash = createHash('sha256');
      
      const input = createReadStream('test.js');
      input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
      const { createHash } = require('node:crypto');
      const { stdout } = require('node:process');
      
      const hash = createHash('sha256');
      
      const input = createReadStream('test.js');
      input.pipe(hash).setEncoding('hex').pipe(stdout);
      69 (default) or
      import { createReadStream } from 'node:fs';
      import { stdout } from 'node:process';
      const { createHash } = await import('node:crypto');
      
      const hash = createHash('sha256');
      
      const input = createReadStream('test.js');
      input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
      const { createHash } = require('node:crypto');
      const { stdout } = require('node:process');
      
      const hash = createHash('sha256');
      
      const input = createReadStream('test.js');
      input.pipe(hash).setEncoding('hex').pipe(stdout);
      67

    For public keys, the following encoding options can be used

    • import { createReadStream } from 'node:fs';
      import { stdout } from 'node:process';
      const { createHash } = await import('node:crypto');
      
      const hash = createHash('sha256');
      
      const input = createReadStream('test.js');
      input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
      const { createHash } = require('node:crypto');
      const { stdout } = require('node:process');
      
      const hash = createHash('sha256');
      
      const input = createReadStream('test.js');
      input.pipe(hash).setEncoding('hex').pipe(stdout);
      71. Must be one of
      import { createReadStream } from 'node:fs';
      import { stdout } from 'node:process';
      const { createHash } = await import('node:crypto');
      
      const hash = createHash('sha256');
      
      const input = createReadStream('test.js');
      input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
      const { createHash } = require('node:crypto');
      const { stdout } = require('node:process');
      
      const hash = createHash('sha256');
      
      const input = createReadStream('test.js');
      input.pipe(hash).setEncoding('hex').pipe(stdout);
      72 (RSA only) or
      import { createReadStream } from 'node:fs';
      import { stdout } from 'node:process';
      const { createHash } = await import('node:crypto');
      
      const hash = createHash('sha256');
      
      const input = createReadStream('test.js');
      input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
      const { createHash } = require('node:crypto');
      const { stdout } = require('node:process');
      
      const hash = createHash('sha256');
      
      const input = createReadStream('test.js');
      input.pipe(hash).setEncoding('hex').pipe(stdout);
      73
    • const { Certificate } = await import('node:crypto');
      
      const cert1 = new Certificate();
      const cert2 = Certificate();const { Certificate } = require('node:crypto');
      
      const cert1 = new Certificate();
      const cert2 = Certificate();
      65. Must be
      import { createReadStream } from 'node:fs';
      import { stdout } from 'node:process';
      const { createHash } = await import('node:crypto');
      
      const hash = createHash('sha256');
      
      const input = createReadStream('test.js');
      input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
      const { createHash } = require('node:crypto');
      const { stdout } = require('node:process');
      
      const hash = createHash('sha256');
      
      const input = createReadStream('test.js');
      input.pipe(hash).setEncoding('hex').pipe(stdout);
      75,
      import { createReadStream } from 'node:fs';
      import { stdout } from 'node:process';
      const { createHash } = await import('node:crypto');
      
      const hash = createHash('sha256');
      
      const input = createReadStream('test.js');
      input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
      const { createHash } = require('node:crypto');
      const { stdout } = require('node:process');
      
      const hash = createHash('sha256');
      
      const input = createReadStream('test.js');
      input.pipe(hash).setEncoding('hex').pipe(stdout);
      76, or
      import { createReadStream } from 'node:fs';
      import { stdout } from 'node:process';
      const { createHash } = await import('node:crypto');
      
      const hash = createHash('sha256');
      
      const input = createReadStream('test.js');
      input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
      const { createHash } = require('node:crypto');
      const { stdout } = require('node:process');
      
      const hash = createHash('sha256');
      
      const input = createReadStream('test.js');
      input.pipe(hash).setEncoding('hex').pipe(stdout);
      67

    Untuk kunci pribadi, opsi penyandian berikut dapat digunakan

    • import { createReadStream } from 'node:fs';
      import { stdout } from 'node:process';
      const { createHash } = await import('node:crypto');
      
      const hash = createHash('sha256');
      
      const input = createReadStream('test.js');
      input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
      const { createHash } = require('node:crypto');
      const { stdout } = require('node:process');
      
      const hash = createHash('sha256');
      
      const input = createReadStream('test.js');
      input.pipe(hash).setEncoding('hex').pipe(stdout);
      71. Must be one of
      import { createReadStream } from 'node:fs';
      import { stdout } from 'node:process';
      const { createHash } = await import('node:crypto');
      
      const hash = createHash('sha256');
      
      const input = createReadStream('test.js');
      input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
      const { createHash } = require('node:crypto');
      const { stdout } = require('node:process');
      
      const hash = createHash('sha256');
      
      const input = createReadStream('test.js');
      input.pipe(hash).setEncoding('hex').pipe(stdout);
      72 (RSA only),
      import { createReadStream } from 'node:fs';
      import { stdout } from 'node:process';
      const { createHash } = await import('node:crypto');
      
      const hash = createHash('sha256');
      
      const input = createReadStream('test.js');
      input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
      const { createHash } = require('node:crypto');
      const { stdout } = require('node:process');
      
      const hash = createHash('sha256');
      
      const input = createReadStream('test.js');
      input.pipe(hash).setEncoding('hex').pipe(stdout);
      80 or
      import { createReadStream } from 'node:fs';
      import { stdout } from 'node:process';
      const { createHash } = await import('node:crypto');
      
      const hash = createHash('sha256');
      
      const input = createReadStream('test.js');
      input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
      const { createHash } = require('node:crypto');
      const { stdout } = require('node:process');
      
      const hash = createHash('sha256');
      
      const input = createReadStream('test.js');
      input.pipe(hash).setEncoding('hex').pipe(stdout);
      81 (EC only)
    • const { Certificate } = await import('node:crypto');
      
      const cert1 = new Certificate();
      const cert2 = Certificate();const { Certificate } = require('node:crypto');
      
      const cert1 = new Certificate();
      const cert2 = Certificate();
      65. Must be
      import { createReadStream } from 'node:fs';
      import { stdout } from 'node:process';
      const { createHash } = await import('node:crypto');
      
      const hash = createHash('sha256');
      
      const input = createReadStream('test.js');
      input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
      const { createHash } = require('node:crypto');
      const { stdout } = require('node:process');
      
      const hash = createHash('sha256');
      
      const input = createReadStream('test.js');
      input.pipe(hash).setEncoding('hex').pipe(stdout);
      75,
      import { createReadStream } from 'node:fs';
      import { stdout } from 'node:process';
      const { createHash } = await import('node:crypto');
      
      const hash = createHash('sha256');
      
      const input = createReadStream('test.js');
      input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
      const { createHash } = require('node:crypto');
      const { stdout } = require('node:process');
      
      const hash = createHash('sha256');
      
      const input = createReadStream('test.js');
      input.pipe(hash).setEncoding('hex').pipe(stdout);
      76, or
      import { createReadStream } from 'node:fs';
      import { stdout } from 'node:process';
      const { createHash } = await import('node:crypto');
      
      const hash = createHash('sha256');
      
      const input = createReadStream('test.js');
      input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
      const { createHash } = require('node:crypto');
      const { stdout } = require('node:process');
      
      const hash = createHash('sha256');
      
      const input = createReadStream('test.js');
      input.pipe(hash).setEncoding('hex').pipe(stdout);
      67
    • const { X509Certificate } = await import('node:crypto');
      
      const x509 = new X509Certificate('{.. pem encoded cert ...}');
      
      console.log(x509.subject);const { X509Certificate } = require('node:crypto');
      
      const x509 = new X509Certificate('{.. pem encoded cert ...}');
      
      console.log(x509.subject);
      7. If specified, the private key will be encrypted with the given
      const { X509Certificate } = await import('node:crypto');
      
      const x509 = new X509Certificate('{.. pem encoded cert ...}');
      
      console.log(x509.subject);const { X509Certificate } = require('node:crypto');
      
      const x509 = new X509Certificate('{.. pem encoded cert ...}');
      
      console.log(x509.subject);
      7 and
      import { createReadStream } from 'node:fs';
      import { stdout } from 'node:process';
      const { createHash } = await import('node:crypto');
      
      const hash = createHash('sha256');
      
      const input = createReadStream('test.js');
      input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
      const { createHash } = require('node:crypto');
      const { stdout } = require('node:process');
      
      const hash = createHash('sha256');
      
      const input = createReadStream('test.js');
      input.pipe(hash).setEncoding('hex').pipe(stdout);
      88 using PKCS#5 v2. 0 password based encryption
    • import { createReadStream } from 'node:fs';
      import { stdout } from 'node:process';
      const { createHash } = await import('node:crypto');
      
      const hash = createHash('sha256');
      
      const input = createReadStream('test.js');
      input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
      const { createHash } = require('node:crypto');
      const { stdout } = require('node:process');
      
      const hash = createHash('sha256');
      
      const input = createReadStream('test.js');
      input.pipe(hash).setEncoding('hex').pipe(stdout);
      88. . The passphrase to use for encryption, see
      const { X509Certificate } = await import('node:crypto');
      
      const x509 = new X509Certificate('{.. pem encoded cert ...}');
      
      console.log(x509.subject);const { X509Certificate } = require('node:crypto');
      
      const x509 = new X509Certificate('{.. pem encoded cert ...}');
      
      console.log(x509.subject);
      7

    The result type depends on the selected encoding format, when PEM the result is a string, when DER it will be a buffer containing the data encoded as DER, when JWK it will be an object

    When JWK encoding format was selected, all other encoding options are ignored

    PKCS#1, SEC1, and PKCS#8 type keys can be encrypted by using a combination of the

    const { X509Certificate } = await import('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);
    7 and
    const { Certificate } = await import('node:crypto');
    
    const cert1 = new Certificate();
    const cert2 = Certificate();const { Certificate } = require('node:crypto');
    
    const cert1 = new Certificate();
    const cert2 = Certificate();
    65 options. The PKCS#8
    import { createReadStream } from 'node:fs';
    import { stdout } from 'node:process';
    const { createHash } = await import('node:crypto');
    
    const hash = createHash('sha256');
    
    const input = createReadStream('test.js');
    input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
    const { createHash } = require('node:crypto');
    const { stdout } = require('node:process');
    
    const hash = createHash('sha256');
    
    const input = createReadStream('test.js');
    input.pipe(hash).setEncoding('hex').pipe(stdout);
    71 can be used with any
    const { Certificate } = await import('node:crypto');
    
    const cert1 = new Certificate();
    const cert2 = Certificate();const { Certificate } = require('node:crypto');
    
    const cert1 = new Certificate();
    const cert2 = Certificate();
    65 to encrypt any key algorithm (RSA, EC, or DH) by specifying a
    const { X509Certificate } = await import('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);
    7. PKCS#1 and SEC1 can only be encrypted by specifying a
    const { X509Certificate } = await import('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);
    7 when the PEM
    const { Certificate } = await import('node:crypto');
    
    const cert1 = new Certificate();
    const cert2 = Certificate();const { Certificate } = require('node:crypto');
    
    const cert1 = new Certificate();
    const cert2 = Certificate();
    65 is used. For maximum compatibility, use PKCS#8 for encrypted private keys. Since PKCS#8 defines its own encryption mechanism, PEM-level encryption is not supported when encrypting a PKCS#8 key. See RFC 5208 for PKCS#8 encryption and RFC 1421 for PKCS#1 and SEC1 encryption

    import { createReadStream } from 'node:fs';
    import { stdout } from 'node:process';
    const { createHash } = await import('node:crypto');
    
    const hash = createHash('sha256');
    
    const input = createReadStream('test.js');
    input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
    const { createHash } = require('node:crypto');
    const { stdout } = require('node:process');
    
    const hash = createHash('sha256');
    
    const input = createReadStream('test.js');
    input.pipe(hash).setEncoding('hex').pipe(stdout);
    98

    Added in. v17. 7. 0, v16. 15. 0

    Returns

    import { createReadStream } from 'node:fs';
    import { stdout } from 'node:process';
    const { createHash } = await import('node:crypto');
    
    const hash = createHash('sha256');
    
    const input = createReadStream('test.js');
    input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
    const { createHash } = require('node:crypto');
    const { stdout } = require('node:process');
    
    const hash = createHash('sha256');
    
    const input = createReadStream('test.js');
    input.pipe(hash).setEncoding('hex').pipe(stdout);
    99 or
    import { Buffer } from 'node:buffer';
    const { randomFillSync } = await import('node:crypto');
    
    const a = new Uint32Array(10);
    console.log(Buffer.from(randomFillSync(a).buffer,
                            a.byteOffset, a.byteLength).toString('hex'));
    
    const b = new DataView(new ArrayBuffer(10));
    console.log(Buffer.from(randomFillSync(b).buffer,
                            b.byteOffset, b.byteLength).toString('hex'));
    
    const c = new ArrayBuffer(10);
    console.log(Buffer.from(randomFillSync(c)).toString('hex'));const { randomFillSync } = require('node:crypto');
    const { Buffer } = require('node:buffer');
    
    const a = new Uint32Array(10);
    console.log(Buffer.from(randomFillSync(a).buffer,
                            a.byteOffset, a.byteLength).toString('hex'));
    
    const b = new DataView(new ArrayBuffer(10));
    console.log(Buffer.from(randomFillSync(b).buffer,
                            b.byteOffset, b.byteLength).toString('hex'));
    
    const c = new ArrayBuffer(10);
    console.log(Buffer.from(randomFillSync(c)).toString('hex'));
    6 depending on whether the keys have exactly the same type, value, and parameters. This method is not constant time

    import { createReadStream } from 'node:fs';
    import { stdout } from 'node:process';
    const {
      createHmac,
    } = await import('node:crypto');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);const {
      createReadStream,
    } = require('node:fs');
    const {
      createHmac,
    } = require('node:crypto');
    const { stdout } = require('node:process');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);
    01

    For secret keys, this property represents the size of the key in bytes. This property is

    import { createReadStream } from 'node:fs';
    import { stdout } from 'node:process';
    const { createHash } = await import('node:crypto');
    
    const hash = createHash('sha256');
    
    const input = createReadStream('test.js');
    input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
    const { createHash } = require('node:crypto');
    const { stdout } = require('node:process');
    
    const hash = createHash('sha256');
    
    const input = createReadStream('test.js');
    input.pipe(hash).setEncoding('hex').pipe(stdout);
    50 for asymmetric keys

    import { createReadStream } from 'node:fs';
    import { stdout } from 'node:process';
    const {
      createHmac,
    } = await import('node:crypto');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);const {
      createReadStream,
    } = require('node:fs');
    const {
      createHmac,
    } = require('node:crypto');
    const { stdout } = require('node:process');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);
    03

    Depending on the type of this

    import { createReadStream } from 'node:fs';
    import { stdout } from 'node:process';
    const { createHash } = await import('node:crypto');
    
    const hash = createHash('sha256');
    
    const input = createReadStream('test.js');
    input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
    const { createHash } = require('node:crypto');
    const { stdout } = require('node:process');
    
    const hash = createHash('sha256');
    
    const input = createReadStream('test.js');
    input.pipe(hash).setEncoding('hex').pipe(stdout);
    14, this property is either
    import { createReadStream } from 'node:fs';
    import { stdout } from 'node:process';
    const {
      createHmac,
    } = await import('node:crypto');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);const {
      createReadStream,
    } = require('node:fs');
    const {
      createHmac,
    } = require('node:crypto');
    const { stdout } = require('node:process');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);
    05 for secret (symmetric) keys,
    import { createReadStream } from 'node:fs';
    import { stdout } from 'node:process';
    const {
      createHmac,
    } = await import('node:crypto');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);const {
      createReadStream,
    } = require('node:fs');
    const {
      createHmac,
    } = require('node:crypto');
    const { stdout } = require('node:process');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);
    06 for public (asymmetric) keys or
    import { createReadStream } from 'node:fs';
    import { stdout } from 'node:process';
    const {
      createHmac,
    } = await import('node:crypto');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);const {
      createReadStream,
    } = require('node:fs');
    const {
      createHmac,
    } = require('node:crypto');
    const { stdout } = require('node:process');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);
    07 for private (asymmetric) keys

    Class. import { createReadStream } from 'node:fs'; import { stdout } from 'node:process'; const { createHmac, } = await import('node:crypto'); const hmac = createHmac('sha256', 'a secret'); const input = createReadStream('test.js'); input.pipe(hmac).pipe(stdout);const { createReadStream, } = require('node:fs'); const { createHmac, } = require('node:crypto'); const { stdout } = require('node:process'); const hmac = createHmac('sha256', 'a secret'); const input = createReadStream('test.js'); input.pipe(hmac).pipe(stdout);08

    The

    import { createReadStream } from 'node:fs';
    import { stdout } from 'node:process';
    const {
      createHmac,
    } = await import('node:crypto');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);const {
      createReadStream,
    } = require('node:fs');
    const {
      createHmac,
    } = require('node:crypto');
    const { stdout } = require('node:process');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);
    08 class is a utility for generating signatures. It can be used in one of two ways

    The method is used to create

    import { createReadStream } from 'node:fs';
    import { stdout } from 'node:process';
    const {
      createHmac,
    } = await import('node:crypto');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);const {
      createReadStream,
    } = require('node:fs');
    const {
      createHmac,
    } = require('node:crypto');
    const { stdout } = require('node:process');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);
    08 instances. The argument is the string name of the hash function to use.
    import { createReadStream } from 'node:fs';
    import { stdout } from 'node:process';
    const {
      createHmac,
    } = await import('node:crypto');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);const {
      createReadStream,
    } = require('node:fs');
    const {
      createHmac,
    } = require('node:crypto');
    const { stdout } = require('node:process');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);
    08 objects are not to be created directly using the
    const { createDiffieHellmanGroup } = await import('node:crypto');
    const dh = createDiffieHellmanGroup('modp16');const { createDiffieHellmanGroup } = require('node:crypto');
    const dh = createDiffieHellmanGroup('modp16');
    1 keyword

    Example. Using

    import { createReadStream } from 'node:fs';
    import { stdout } from 'node:process';
    const {
      createHmac,
    } = await import('node:crypto');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);const {
      createReadStream,
    } = require('node:fs');
    const {
      createHmac,
    } = require('node:crypto');
    const { stdout } = require('node:process');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);
    08 and objects as streams

    Example. Using the and methods

    import { createReadStream } from 'node:fs';
    import { stdout } from 'node:process';
    const {
      createHmac,
    } = await import('node:crypto');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);const {
      createReadStream,
    } = require('node:fs');
    const {
      createHmac,
    } = require('node:crypto');
    const { stdout } = require('node:process');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);
    18

    HistoryVersionChangesv15. 0. 0

    The privateKey can also be an ArrayBuffer and CryptoKey

    v13. 2. 0, v12. 16. 0

    This function now supports IEEE-P1363 DSA and ECDSA signatures

    v12. 0. 0

    This function now supports RSA-PSS keys

    v11. 6. 0

    This function now supports key objects

    v8. 0. 0

    Support for RSASSA-PSS and additional options was added

    v0. 1. 92

    ditambahkan. v0. 1. 92

    Calculates the signature on all the data passed through using either or

    If

    const { Certificate } = await import('node:crypto');
    
    const cert1 = new Certificate();
    const cert2 = Certificate();const { Certificate } = require('node:crypto');
    
    const cert1 = new Certificate();
    const cert2 = Certificate();
    32 is not a , this function behaves as if
    const { Certificate } = await import('node:crypto');
    
    const cert1 = new Certificate();
    const cert2 = Certificate();const { Certificate } = require('node:crypto');
    
    const cert1 = new Certificate();
    const cert2 = Certificate();
    32 had been passed to . If it is an object, the following additional properties can be passed

    • import { createReadStream } from 'node:fs';
      import { stdout } from 'node:process';
      const {
        createHmac,
      } = await import('node:crypto');
      
      const hmac = createHmac('sha256', 'a secret');
      
      const input = createReadStream('test.js');
      input.pipe(hmac).pipe(stdout);const {
        createReadStream,
      } = require('node:fs');
      const {
        createHmac,
      } = require('node:crypto');
      const { stdout } = require('node:process');
      
      const hmac = createHmac('sha256', 'a secret');
      
      const input = createReadStream('test.js');
      input.pipe(hmac).pipe(stdout);
      25 For DSA and ECDSA, this option specifies the format of the generated signature. It can be one of the following

      • import { createReadStream } from 'node:fs';
        import { stdout } from 'node:process';
        const { createHash } = await import('node:crypto');
        
        const hash = createHash('sha256');
        
        const input = createReadStream('test.js');
        input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
        const { createHash } = require('node:crypto');
        const { stdout } = require('node:process');
        
        const hash = createHash('sha256');
        
        const input = createReadStream('test.js');
        input.pipe(hash).setEncoding('hex').pipe(stdout);
        76 (default). DER-encoded ASN. 1 signature structure encoding
        import { createReadStream } from 'node:fs';
        import { stdout } from 'node:process';
        const {
          createHmac,
        } = await import('node:crypto');
        
        const hmac = createHmac('sha256', 'a secret');
        
        const input = createReadStream('test.js');
        input.pipe(hmac).pipe(stdout);const {
          createReadStream,
        } = require('node:fs');
        const {
          createHmac,
        } = require('node:crypto');
        const { stdout } = require('node:process');
        
        const hmac = createHmac('sha256', 'a secret');
        
        const input = createReadStream('test.js');
        input.pipe(hmac).pipe(stdout);
        27
      • import { createReadStream } from 'node:fs';
        import { stdout } from 'node:process';
        const {
          createHmac,
        } = await import('node:crypto');
        
        const hmac = createHmac('sha256', 'a secret');
        
        const input = createReadStream('test.js');
        input.pipe(hmac).pipe(stdout);const {
          createReadStream,
        } = require('node:fs');
        const {
          createHmac,
        } = require('node:crypto');
        const { stdout } = require('node:process');
        
        const hmac = createHmac('sha256', 'a secret');
        
        const input = createReadStream('test.js');
        input.pipe(hmac).pipe(stdout);
        28. Signature format
        import { createReadStream } from 'node:fs';
        import { stdout } from 'node:process';
        const {
          createHmac,
        } = await import('node:crypto');
        
        const hmac = createHmac('sha256', 'a secret');
        
        const input = createReadStream('test.js');
        input.pipe(hmac).pipe(stdout);const {
          createReadStream,
        } = require('node:fs');
        const {
          createHmac,
        } = require('node:crypto');
        const { stdout } = require('node:process');
        
        const hmac = createHmac('sha256', 'a secret');
        
        const input = createReadStream('test.js');
        input.pipe(hmac).pipe(stdout);
        29 as proposed in IEEE-P1363
    • import { createReadStream } from 'node:fs';
      import { stdout } from 'node:process';
      const {
        createHmac,
      } = await import('node:crypto');
      
      const hmac = createHmac('sha256', 'a secret');
      
      const input = createReadStream('test.js');
      input.pipe(hmac).pipe(stdout);const {
        createReadStream,
      } = require('node:fs');
      const {
        createHmac,
      } = require('node:crypto');
      const { stdout } = require('node:process');
      
      const hmac = createHmac('sha256', 'a secret');
      
      const input = createReadStream('test.js');
      input.pipe(hmac).pipe(stdout);
      30 Optional padding value for RSA, one of the following

      • import { createReadStream } from 'node:fs';
        import { stdout } from 'node:process';
        const {
          createHmac,
        } = await import('node:crypto');
        
        const hmac = createHmac('sha256', 'a secret');
        
        const input = createReadStream('test.js');
        input.pipe(hmac).pipe(stdout);const {
          createReadStream,
        } = require('node:fs');
        const {
          createHmac,
        } = require('node:crypto');
        const { stdout } = require('node:process');
        
        const hmac = createHmac('sha256', 'a secret');
        
        const input = createReadStream('test.js');
        input.pipe(hmac).pipe(stdout);
        31 (default)
      • import { createReadStream } from 'node:fs';
        import { stdout } from 'node:process';
        const {
          createHmac,
        } = await import('node:crypto');
        
        const hmac = createHmac('sha256', 'a secret');
        
        const input = createReadStream('test.js');
        input.pipe(hmac).pipe(stdout);const {
          createReadStream,
        } = require('node:fs');
        const {
          createHmac,
        } = require('node:crypto');
        const { stdout } = require('node:process');
        
        const hmac = createHmac('sha256', 'a secret');
        
        const input = createReadStream('test.js');
        input.pipe(hmac).pipe(stdout);
        32

      import { createReadStream } from 'node:fs';
      import { stdout } from 'node:process';
      const {
        createHmac,
      } = await import('node:crypto');
      
      const hmac = createHmac('sha256', 'a secret');
      
      const input = createReadStream('test.js');
      input.pipe(hmac).pipe(stdout);const {
        createReadStream,
      } = require('node:fs');
      const {
        createHmac,
      } = require('node:crypto');
      const { stdout } = require('node:process');
      
      const hmac = createHmac('sha256', 'a secret');
      
      const input = createReadStream('test.js');
      input.pipe(hmac).pipe(stdout);
      33 will use MGF1 with the same hash function used to sign the message as specified in section 3. 1 of RFC 4055, unless an MGF1 hash function has been specified as part of the key in compliance with section 3. 3 of RFC 4055

    • import { createReadStream } from 'node:fs';
      import { stdout } from 'node:process';
      const { createHash } = await import('node:crypto');
      
      const hash = createHash('sha256');
      
      const input = createReadStream('test.js');
      input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
      const { createHash } = require('node:crypto');
      const { stdout } = require('node:process');
      
      const hash = createHash('sha256');
      
      const input = createReadStream('test.js');
      input.pipe(hash).setEncoding('hex').pipe(stdout);
      39 Salt length for when padding is
      import { createReadStream } from 'node:fs';
      import { stdout } from 'node:process';
      const {
        createHmac,
      } = await import('node:crypto');
      
      const hmac = createHmac('sha256', 'a secret');
      
      const input = createReadStream('test.js');
      input.pipe(hmac).pipe(stdout);const {
        createReadStream,
      } = require('node:fs');
      const {
        createHmac,
      } = require('node:crypto');
      const { stdout } = require('node:process');
      
      const hmac = createHmac('sha256', 'a secret');
      
      const input = createReadStream('test.js');
      input.pipe(hmac).pipe(stdout);
      33. The special value
      import { createReadStream } from 'node:fs';
      import { stdout } from 'node:process';
      const {
        createHmac,
      } = await import('node:crypto');
      
      const hmac = createHmac('sha256', 'a secret');
      
      const input = createReadStream('test.js');
      input.pipe(hmac).pipe(stdout);const {
        createReadStream,
      } = require('node:fs');
      const {
        createHmac,
      } = require('node:crypto');
      const { stdout } = require('node:process');
      
      const hmac = createHmac('sha256', 'a secret');
      
      const input = createReadStream('test.js');
      input.pipe(hmac).pipe(stdout);
      36 sets the salt length to the digest size,
      import { createReadStream } from 'node:fs';
      import { stdout } from 'node:process';
      const {
        createHmac,
      } = await import('node:crypto');
      
      const hmac = createHmac('sha256', 'a secret');
      
      const input = createReadStream('test.js');
      input.pipe(hmac).pipe(stdout);const {
        createReadStream,
      } = require('node:fs');
      const {
        createHmac,
      } = require('node:crypto');
      const { stdout } = require('node:process');
      
      const hmac = createHmac('sha256', 'a secret');
      
      const input = createReadStream('test.js');
      input.pipe(hmac).pipe(stdout);
      37 (default) sets it to the maximum permissible value

    If

    import { createReadStream } from 'node:fs';
    import { stdout } from 'node:process';
    const {
      createHmac,
    } = await import('node:crypto');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);const {
      createReadStream,
    } = require('node:fs');
    const {
      createHmac,
    } = require('node:crypto');
    const { stdout } = require('node:process');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);
    0 is provided a string is returned; otherwise a
    import { createReadStream } from 'node:fs';
    import { stdout } from 'node:process';
    const {
      createHmac,
    } = await import('node:crypto');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);const {
      createReadStream,
    } = require('node:fs');
    const {
      createHmac,
    } = require('node:crypto');
    const { stdout } = require('node:process');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);
    3 is returned

    The

    import { createReadStream } from 'node:fs';
    import { stdout } from 'node:process';
    const {
      createHmac,
    } = await import('node:crypto');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);const {
      createReadStream,
    } = require('node:fs');
    const {
      createHmac,
    } = require('node:crypto');
    const { stdout } = require('node:process');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);
    08 object can not be again used after
    import { createReadStream } from 'node:fs';
    import { stdout } from 'node:process';
    const {
      createHmac,
    } = await import('node:crypto');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);const {
      createReadStream,
    } = require('node:fs');
    const {
      createHmac,
    } = require('node:crypto');
    const { stdout } = require('node:process');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);
    41 method has been called. Multiple calls to
    import { createReadStream } from 'node:fs';
    import { stdout } from 'node:process';
    const {
      createHmac,
    } = await import('node:crypto');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);const {
      createReadStream,
    } = require('node:fs');
    const {
      createHmac,
    } = require('node:crypto');
    const { stdout } = require('node:process');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);
    41 will result in an error being thrown

    import { createReadStream } from 'node:fs';
    import { stdout } from 'node:process';
    const {
      createHmac,
    } = await import('node:crypto');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);const {
      createReadStream,
    } = require('node:fs');
    const {
      createHmac,
    } = require('node:crypto');
    const { stdout } = require('node:process');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);
    43

    HistoryVersionChangesv6. 0. 0

    import { Buffer } from 'node:buffer';
    const { randomFill } = await import('node:crypto');
    
    const a = new Uint32Array(10);
    randomFill(a, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
        .toString('hex'));
    });
    
    const b = new DataView(new ArrayBuffer(10));
    randomFill(b, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
        .toString('hex'));
    });
    
    const c = new ArrayBuffer(10);
    randomFill(c, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf).toString('hex'));
    });const { randomFill } = require('node:crypto');
    const { Buffer } = require('node:buffer');
    
    const a = new Uint32Array(10);
    randomFill(a, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
        .toString('hex'));
    });
    
    const b = new DataView(new ArrayBuffer(10));
    randomFill(b, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
        .toString('hex'));
    });
    
    const c = new ArrayBuffer(10);
    randomFill(c, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf).toString('hex'));
    });
    2 default diubah dari
    import { Buffer } from 'node:buffer';
    const { randomFill } = await import('node:crypto');
    
    const a = new Uint32Array(10);
    randomFill(a, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
        .toString('hex'));
    });
    
    const b = new DataView(new ArrayBuffer(10));
    randomFill(b, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
        .toString('hex'));
    });
    
    const c = new ArrayBuffer(10);
    randomFill(c, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf).toString('hex'));
    });const { randomFill } = require('node:crypto');
    const { Buffer } = require('node:buffer');
    
    const a = new Uint32Array(10);
    randomFill(a, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
        .toString('hex'));
    });
    
    const b = new DataView(new ArrayBuffer(10));
    randomFill(b, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
        .toString('hex'));
    });
    
    const c = new ArrayBuffer(10);
    randomFill(c, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf).toString('hex'));
    });
    3 menjadi
    import { Buffer } from 'node:buffer';
    const { randomFill } = await import('node:crypto');
    
    const a = new Uint32Array(10);
    randomFill(a, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
        .toString('hex'));
    });
    
    const b = new DataView(new ArrayBuffer(10));
    randomFill(b, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
        .toString('hex'));
    });
    
    const c = new ArrayBuffer(10);
    randomFill(c, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf).toString('hex'));
    });const { randomFill } = require('node:crypto');
    const { Buffer } = require('node:buffer');
    
    const a = new Uint32Array(10);
    randomFill(a, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
        .toString('hex'));
    });
    
    const b = new DataView(new ArrayBuffer(10));
    randomFill(b, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
        .toString('hex'));
    });
    
    const c = new ArrayBuffer(10);
    randomFill(c, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf).toString('hex'));
    });
    4

    v0. 1. 92

    ditambahkan. v0. 1. 92

    Updates the

    import { createReadStream } from 'node:fs';
    import { stdout } from 'node:process';
    const {
      createHmac,
    } = await import('node:crypto');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);const {
      createReadStream,
    } = require('node:fs');
    const {
      createHmac,
    } = require('node:crypto');
    const { stdout } = require('node:process');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);
    08 content with the given
    import { Buffer } from 'node:buffer';
    const { randomFill } = await import('node:crypto');
    
    const a = new Uint32Array(10);
    randomFill(a, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
        .toString('hex'));
    });
    
    const b = new DataView(new ArrayBuffer(10));
    randomFill(b, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
        .toString('hex'));
    });
    
    const c = new ArrayBuffer(10);
    randomFill(c, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf).toString('hex'));
    });const { randomFill } = require('node:crypto');
    const { Buffer } = require('node:buffer');
    
    const a = new Uint32Array(10);
    randomFill(a, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
        .toString('hex'));
    });
    
    const b = new DataView(new ArrayBuffer(10));
    randomFill(b, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
        .toString('hex'));
    });
    
    const c = new ArrayBuffer(10);
    randomFill(c, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf).toString('hex'));
    });
    5, the encoding of which is given in
    import { Buffer } from 'node:buffer';
    const { randomFill } = await import('node:crypto');
    
    const a = new Uint32Array(10);
    randomFill(a, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
        .toString('hex'));
    });
    
    const b = new DataView(new ArrayBuffer(10));
    randomFill(b, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
        .toString('hex'));
    });
    
    const c = new ArrayBuffer(10);
    randomFill(c, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf).toString('hex'));
    });const { randomFill } = require('node:crypto');
    const { Buffer } = require('node:buffer');
    
    const a = new Uint32Array(10);
    randomFill(a, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
        .toString('hex'));
    });
    
    const b = new DataView(new ArrayBuffer(10));
    randomFill(b, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
        .toString('hex'));
    });
    
    const c = new ArrayBuffer(10);
    randomFill(c, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf).toString('hex'));
    });
    2. If
    const { Certificate } = await import('node:crypto');
    
    const cert1 = new Certificate();
    const cert2 = Certificate();const { Certificate } = require('node:crypto');
    
    const cert1 = new Certificate();
    const cert2 = Certificate();
    11 is not provided, and the
    import { Buffer } from 'node:buffer';
    const { randomFill } = await import('node:crypto');
    
    const a = new Uint32Array(10);
    randomFill(a, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
        .toString('hex'));
    });
    
    const b = new DataView(new ArrayBuffer(10));
    randomFill(b, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
        .toString('hex'));
    });
    
    const c = new ArrayBuffer(10);
    randomFill(c, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf).toString('hex'));
    });const { randomFill } = require('node:crypto');
    const { Buffer } = require('node:buffer');
    
    const a = new Uint32Array(10);
    randomFill(a, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
        .toString('hex'));
    });
    
    const b = new DataView(new ArrayBuffer(10));
    randomFill(b, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
        .toString('hex'));
    });
    
    const c = new ArrayBuffer(10);
    randomFill(c, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf).toString('hex'));
    });
    5 is a string, an encoding of
    const { createDiffieHellmanGroup } = await import('node:crypto');
    const dh = createDiffieHellmanGroup('modp16');const { createDiffieHellmanGroup } = require('node:crypto');
    const dh = createDiffieHellmanGroup('modp16');
    74 is enforced. If
    import { Buffer } from 'node:buffer';
    const { randomFill } = await import('node:crypto');
    
    const a = new Uint32Array(10);
    randomFill(a, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
        .toString('hex'));
    });
    
    const b = new DataView(new ArrayBuffer(10));
    randomFill(b, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
        .toString('hex'));
    });
    
    const c = new ArrayBuffer(10);
    randomFill(c, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf).toString('hex'));
    });const { randomFill } = require('node:crypto');
    const { Buffer } = require('node:buffer');
    
    const a = new Uint32Array(10);
    randomFill(a, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
        .toString('hex'));
    });
    
    const b = new DataView(new ArrayBuffer(10));
    randomFill(b, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
        .toString('hex'));
    });
    
    const c = new ArrayBuffer(10);
    randomFill(c, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf).toString('hex'));
    });
    5 is a
    import { createReadStream } from 'node:fs';
    import { stdout } from 'node:process';
    const {
      createHmac,
    } = await import('node:crypto');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);const {
      createReadStream,
    } = require('node:fs');
    const {
      createHmac,
    } = require('node:crypto');
    const { stdout } = require('node:process');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);
    3,
    let crypto;
    try {
      crypto = await import('node:crypto');
    } catch (err) {
      console.error('crypto support is disabled!');
    }
    01, or
    let crypto;
    try {
      crypto = await import('node:crypto');
    } catch (err) {
      console.error('crypto support is disabled!');
    }
    02, then
    import { Buffer } from 'node:buffer';
    const { randomFill } = await import('node:crypto');
    
    const a = new Uint32Array(10);
    randomFill(a, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
        .toString('hex'));
    });
    
    const b = new DataView(new ArrayBuffer(10));
    randomFill(b, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
        .toString('hex'));
    });
    
    const c = new ArrayBuffer(10);
    randomFill(c, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf).toString('hex'));
    });const { randomFill } = require('node:crypto');
    const { Buffer } = require('node:buffer');
    
    const a = new Uint32Array(10);
    randomFill(a, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
        .toString('hex'));
    });
    
    const b = new DataView(new ArrayBuffer(10));
    randomFill(b, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
        .toString('hex'));
    });
    
    const c = new ArrayBuffer(10);
    randomFill(c, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf).toString('hex'));
    });
    2 is ignored

    Ini dapat dipanggil berkali-kali dengan data baru saat dialirkan

    Class. import { createReadStream } from 'node:fs'; import { stdout } from 'node:process'; const { createHmac, } = await import('node:crypto'); const hmac = createHmac('sha256', 'a secret'); const input = createReadStream('test.js'); input.pipe(hmac).pipe(stdout);const { createReadStream, } = require('node:fs'); const { createHmac, } = require('node:crypto'); const { stdout } = require('node:process'); const hmac = createHmac('sha256', 'a secret'); const input = createReadStream('test.js'); input.pipe(hmac).pipe(stdout);_15

    The

    import { createReadStream } from 'node:fs';
    import { stdout } from 'node:process';
    const {
      createHmac,
    } = await import('node:crypto');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);const {
      createReadStream,
    } = require('node:fs');
    const {
      createHmac,
    } = require('node:crypto');
    const { stdout } = require('node:process');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);
    15 class is a utility for verifying signatures. It can be used in one of two ways

    The method is used to create

    import { createReadStream } from 'node:fs';
    import { stdout } from 'node:process';
    const {
      createHmac,
    } = await import('node:crypto');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);const {
      createReadStream,
    } = require('node:fs');
    const {
      createHmac,
    } = require('node:crypto');
    const { stdout } = require('node:process');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);
    15 instances.
    import { createReadStream } from 'node:fs';
    import { stdout } from 'node:process';
    const {
      createHmac,
    } = await import('node:crypto');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);const {
      createReadStream,
    } = require('node:fs');
    const {
      createHmac,
    } = require('node:crypto');
    const { stdout } = require('node:process');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);
    15 objects are not to be created directly using the
    const { createDiffieHellmanGroup } = await import('node:crypto');
    const dh = createDiffieHellmanGroup('modp16');const { createDiffieHellmanGroup } = require('node:crypto');
    const dh = createDiffieHellmanGroup('modp16');
    1 keyword

    See for examples

    import { createReadStream } from 'node:fs';
    import { stdout } from 'node:process';
    const {
      createHmac,
    } = await import('node:crypto');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);const {
      createReadStream,
    } = require('node:fs');
    const {
      createHmac,
    } = require('node:crypto');
    const { stdout } = require('node:process');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);
    65

    HistoryVersionChangesv6. 0. 0

    import { Buffer } from 'node:buffer';
    const { randomFill } = await import('node:crypto');
    
    const a = new Uint32Array(10);
    randomFill(a, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
        .toString('hex'));
    });
    
    const b = new DataView(new ArrayBuffer(10));
    randomFill(b, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
        .toString('hex'));
    });
    
    const c = new ArrayBuffer(10);
    randomFill(c, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf).toString('hex'));
    });const { randomFill } = require('node:crypto');
    const { Buffer } = require('node:buffer');
    
    const a = new Uint32Array(10);
    randomFill(a, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
        .toString('hex'));
    });
    
    const b = new DataView(new ArrayBuffer(10));
    randomFill(b, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
        .toString('hex'));
    });
    
    const c = new ArrayBuffer(10);
    randomFill(c, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf).toString('hex'));
    });
    2 default diubah dari
    import { Buffer } from 'node:buffer';
    const { randomFill } = await import('node:crypto');
    
    const a = new Uint32Array(10);
    randomFill(a, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
        .toString('hex'));
    });
    
    const b = new DataView(new ArrayBuffer(10));
    randomFill(b, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
        .toString('hex'));
    });
    
    const c = new ArrayBuffer(10);
    randomFill(c, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf).toString('hex'));
    });const { randomFill } = require('node:crypto');
    const { Buffer } = require('node:buffer');
    
    const a = new Uint32Array(10);
    randomFill(a, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
        .toString('hex'));
    });
    
    const b = new DataView(new ArrayBuffer(10));
    randomFill(b, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
        .toString('hex'));
    });
    
    const c = new ArrayBuffer(10);
    randomFill(c, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf).toString('hex'));
    });
    3 menjadi
    import { Buffer } from 'node:buffer';
    const { randomFill } = await import('node:crypto');
    
    const a = new Uint32Array(10);
    randomFill(a, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
        .toString('hex'));
    });
    
    const b = new DataView(new ArrayBuffer(10));
    randomFill(b, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
        .toString('hex'));
    });
    
    const c = new ArrayBuffer(10);
    randomFill(c, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf).toString('hex'));
    });const { randomFill } = require('node:crypto');
    const { Buffer } = require('node:buffer');
    
    const a = new Uint32Array(10);
    randomFill(a, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
        .toString('hex'));
    });
    
    const b = new DataView(new ArrayBuffer(10));
    randomFill(b, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
        .toString('hex'));
    });
    
    const c = new ArrayBuffer(10);
    randomFill(c, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf).toString('hex'));
    });
    4

    v0. 1. 92

    ditambahkan. v0. 1. 92

    Updates the

    import { createReadStream } from 'node:fs';
    import { stdout } from 'node:process';
    const {
      createHmac,
    } = await import('node:crypto');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);const {
      createReadStream,
    } = require('node:fs');
    const {
      createHmac,
    } = require('node:crypto');
    const { stdout } = require('node:process');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);
    15 content with the given
    import { Buffer } from 'node:buffer';
    const { randomFill } = await import('node:crypto');
    
    const a = new Uint32Array(10);
    randomFill(a, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
        .toString('hex'));
    });
    
    const b = new DataView(new ArrayBuffer(10));
    randomFill(b, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
        .toString('hex'));
    });
    
    const c = new ArrayBuffer(10);
    randomFill(c, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf).toString('hex'));
    });const { randomFill } = require('node:crypto');
    const { Buffer } = require('node:buffer');
    
    const a = new Uint32Array(10);
    randomFill(a, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
        .toString('hex'));
    });
    
    const b = new DataView(new ArrayBuffer(10));
    randomFill(b, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
        .toString('hex'));
    });
    
    const c = new ArrayBuffer(10);
    randomFill(c, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf).toString('hex'));
    });
    5, the encoding of which is given in
    import { Buffer } from 'node:buffer';
    const { randomFill } = await import('node:crypto');
    
    const a = new Uint32Array(10);
    randomFill(a, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
        .toString('hex'));
    });
    
    const b = new DataView(new ArrayBuffer(10));
    randomFill(b, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
        .toString('hex'));
    });
    
    const c = new ArrayBuffer(10);
    randomFill(c, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf).toString('hex'));
    });const { randomFill } = require('node:crypto');
    const { Buffer } = require('node:buffer');
    
    const a = new Uint32Array(10);
    randomFill(a, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
        .toString('hex'));
    });
    
    const b = new DataView(new ArrayBuffer(10));
    randomFill(b, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
        .toString('hex'));
    });
    
    const c = new ArrayBuffer(10);
    randomFill(c, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf).toString('hex'));
    });
    2. If
    import { Buffer } from 'node:buffer';
    const { randomFill } = await import('node:crypto');
    
    const a = new Uint32Array(10);
    randomFill(a, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
        .toString('hex'));
    });
    
    const b = new DataView(new ArrayBuffer(10));
    randomFill(b, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
        .toString('hex'));
    });
    
    const c = new ArrayBuffer(10);
    randomFill(c, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf).toString('hex'));
    });const { randomFill } = require('node:crypto');
    const { Buffer } = require('node:buffer');
    
    const a = new Uint32Array(10);
    randomFill(a, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
        .toString('hex'));
    });
    
    const b = new DataView(new ArrayBuffer(10));
    randomFill(b, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
        .toString('hex'));
    });
    
    const c = new ArrayBuffer(10);
    randomFill(c, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf).toString('hex'));
    });
    2 is not provided, and the
    import { Buffer } from 'node:buffer';
    const { randomFill } = await import('node:crypto');
    
    const a = new Uint32Array(10);
    randomFill(a, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
        .toString('hex'));
    });
    
    const b = new DataView(new ArrayBuffer(10));
    randomFill(b, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
        .toString('hex'));
    });
    
    const c = new ArrayBuffer(10);
    randomFill(c, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf).toString('hex'));
    });const { randomFill } = require('node:crypto');
    const { Buffer } = require('node:buffer');
    
    const a = new Uint32Array(10);
    randomFill(a, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
        .toString('hex'));
    });
    
    const b = new DataView(new ArrayBuffer(10));
    randomFill(b, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
        .toString('hex'));
    });
    
    const c = new ArrayBuffer(10);
    randomFill(c, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf).toString('hex'));
    });
    5 is a string, an encoding of
    const { createDiffieHellmanGroup } = await import('node:crypto');
    const dh = createDiffieHellmanGroup('modp16');const { createDiffieHellmanGroup } = require('node:crypto');
    const dh = createDiffieHellmanGroup('modp16');
    74 is enforced. If
    import { Buffer } from 'node:buffer';
    const { randomFill } = await import('node:crypto');
    
    const a = new Uint32Array(10);
    randomFill(a, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
        .toString('hex'));
    });
    
    const b = new DataView(new ArrayBuffer(10));
    randomFill(b, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
        .toString('hex'));
    });
    
    const c = new ArrayBuffer(10);
    randomFill(c, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf).toString('hex'));
    });const { randomFill } = require('node:crypto');
    const { Buffer } = require('node:buffer');
    
    const a = new Uint32Array(10);
    randomFill(a, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
        .toString('hex'));
    });
    
    const b = new DataView(new ArrayBuffer(10));
    randomFill(b, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
        .toString('hex'));
    });
    
    const c = new ArrayBuffer(10);
    randomFill(c, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf).toString('hex'));
    });
    5 is a
    import { createReadStream } from 'node:fs';
    import { stdout } from 'node:process';
    const {
      createHmac,
    } = await import('node:crypto');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);const {
      createReadStream,
    } = require('node:fs');
    const {
      createHmac,
    } = require('node:crypto');
    const { stdout } = require('node:process');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);
    3,
    let crypto;
    try {
      crypto = await import('node:crypto');
    } catch (err) {
      console.error('crypto support is disabled!');
    }
    01, or
    let crypto;
    try {
      crypto = await import('node:crypto');
    } catch (err) {
      console.error('crypto support is disabled!');
    }
    02, then
    import { Buffer } from 'node:buffer';
    const { randomFill } = await import('node:crypto');
    
    const a = new Uint32Array(10);
    randomFill(a, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
        .toString('hex'));
    });
    
    const b = new DataView(new ArrayBuffer(10));
    randomFill(b, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
        .toString('hex'));
    });
    
    const c = new ArrayBuffer(10);
    randomFill(c, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf).toString('hex'));
    });const { randomFill } = require('node:crypto');
    const { Buffer } = require('node:buffer');
    
    const a = new Uint32Array(10);
    randomFill(a, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
        .toString('hex'));
    });
    
    const b = new DataView(new ArrayBuffer(10));
    randomFill(b, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
        .toString('hex'));
    });
    
    const c = new ArrayBuffer(10);
    randomFill(c, (err, buf) => {
      if (err) throw err;
      console.log(Buffer.from(buf).toString('hex'));
    });
    2 is ignored

    Ini dapat dipanggil berkali-kali dengan data baru saat dialirkan

    import { createReadStream } from 'node:fs';
    import { stdout } from 'node:process';
    const {
      createHmac,
    } = await import('node:crypto');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);const {
      createReadStream,
    } = require('node:fs');
    const {
      createHmac,
    } = require('node:crypto');
    const { stdout } = require('node:process');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);
    80

    HistoryVersionChangesv15. 0. 0

    The object can also be an ArrayBuffer and CryptoKey

    v13. 2. 0, v12. 16. 0

    This function now supports IEEE-P1363 DSA and ECDSA signatures

    v12. 0. 0

    This function now supports RSA-PSS keys

    v11. 7. 0

    The key can now be a private key

    v8. 0. 0

    Support for RSASSA-PSS and additional options was added

    v0. 1. 92

    ditambahkan. v0. 1. 92

    Verifies the provided data using the given

    import { createReadStream } from 'node:fs';
    import { stdout } from 'node:process';
    const {
      createHmac,
    } = await import('node:crypto');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);const {
      createReadStream,
    } = require('node:fs');
    const {
      createHmac,
    } = require('node:crypto');
    const { stdout } = require('node:process');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);
    81 and
    import { createReadStream } from 'node:fs';
    import { stdout } from 'node:process';
    const {
      createHmac,
    } = await import('node:crypto');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);const {
      createReadStream,
    } = require('node:fs');
    const {
      createHmac,
    } = require('node:crypto');
    const { stdout } = require('node:process');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);
    82

    If

    import { createReadStream } from 'node:fs';
    import { stdout } from 'node:process';
    const {
      createHmac,
    } = await import('node:crypto');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);const {
      createReadStream,
    } = require('node:fs');
    const {
      createHmac,
    } = require('node:crypto');
    const { stdout } = require('node:process');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);
    81 is not a , this function behaves as if
    import { createReadStream } from 'node:fs';
    import { stdout } from 'node:process';
    const {
      createHmac,
    } = await import('node:crypto');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);const {
      createReadStream,
    } = require('node:fs');
    const {
      createHmac,
    } = require('node:crypto');
    const { stdout } = require('node:process');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);
    81 had been passed to . If it is an object, the following additional properties can be passed

    • import { createReadStream } from 'node:fs';
      import { stdout } from 'node:process';
      const {
        createHmac,
      } = await import('node:crypto');
      
      const hmac = createHmac('sha256', 'a secret');
      
      const input = createReadStream('test.js');
      input.pipe(hmac).pipe(stdout);const {
        createReadStream,
      } = require('node:fs');
      const {
        createHmac,
      } = require('node:crypto');
      const { stdout } = require('node:process');
      
      const hmac = createHmac('sha256', 'a secret');
      
      const input = createReadStream('test.js');
      input.pipe(hmac).pipe(stdout);
      25 For DSA and ECDSA, this option specifies the format of the signature. It can be one of the following

      • import { createReadStream } from 'node:fs';
        import { stdout } from 'node:process';
        const { createHash } = await import('node:crypto');
        
        const hash = createHash('sha256');
        
        const input = createReadStream('test.js');
        input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
        const { createHash } = require('node:crypto');
        const { stdout } = require('node:process');
        
        const hash = createHash('sha256');
        
        const input = createReadStream('test.js');
        input.pipe(hash).setEncoding('hex').pipe(stdout);
        76 (default). DER-encoded ASN. 1 signature structure encoding
        import { createReadStream } from 'node:fs';
        import { stdout } from 'node:process';
        const {
          createHmac,
        } = await import('node:crypto');
        
        const hmac = createHmac('sha256', 'a secret');
        
        const input = createReadStream('test.js');
        input.pipe(hmac).pipe(stdout);const {
          createReadStream,
        } = require('node:fs');
        const {
          createHmac,
        } = require('node:crypto');
        const { stdout } = require('node:process');
        
        const hmac = createHmac('sha256', 'a secret');
        
        const input = createReadStream('test.js');
        input.pipe(hmac).pipe(stdout);
        27
      • import { createReadStream } from 'node:fs';
        import { stdout } from 'node:process';
        const {
          createHmac,
        } = await import('node:crypto');
        
        const hmac = createHmac('sha256', 'a secret');
        
        const input = createReadStream('test.js');
        input.pipe(hmac).pipe(stdout);const {
          createReadStream,
        } = require('node:fs');
        const {
          createHmac,
        } = require('node:crypto');
        const { stdout } = require('node:process');
        
        const hmac = createHmac('sha256', 'a secret');
        
        const input = createReadStream('test.js');
        input.pipe(hmac).pipe(stdout);
        28. Signature format
        import { createReadStream } from 'node:fs';
        import { stdout } from 'node:process';
        const {
          createHmac,
        } = await import('node:crypto');
        
        const hmac = createHmac('sha256', 'a secret');
        
        const input = createReadStream('test.js');
        input.pipe(hmac).pipe(stdout);const {
          createReadStream,
        } = require('node:fs');
        const {
          createHmac,
        } = require('node:crypto');
        const { stdout } = require('node:process');
        
        const hmac = createHmac('sha256', 'a secret');
        
        const input = createReadStream('test.js');
        input.pipe(hmac).pipe(stdout);
        29 as proposed in IEEE-P1363
    • import { createReadStream } from 'node:fs';
      import { stdout } from 'node:process';
      const {
        createHmac,
      } = await import('node:crypto');
      
      const hmac = createHmac('sha256', 'a secret');
      
      const input = createReadStream('test.js');
      input.pipe(hmac).pipe(stdout);const {
        createReadStream,
      } = require('node:fs');
      const {
        createHmac,
      } = require('node:crypto');
      const { stdout } = require('node:process');
      
      const hmac = createHmac('sha256', 'a secret');
      
      const input = createReadStream('test.js');
      input.pipe(hmac).pipe(stdout);
      30 Optional padding value for RSA, one of the following

      • import { createReadStream } from 'node:fs';
        import { stdout } from 'node:process';
        const {
          createHmac,
        } = await import('node:crypto');
        
        const hmac = createHmac('sha256', 'a secret');
        
        const input = createReadStream('test.js');
        input.pipe(hmac).pipe(stdout);const {
          createReadStream,
        } = require('node:fs');
        const {
          createHmac,
        } = require('node:crypto');
        const { stdout } = require('node:process');
        
        const hmac = createHmac('sha256', 'a secret');
        
        const input = createReadStream('test.js');
        input.pipe(hmac).pipe(stdout);
        31 (default)
      • import { createReadStream } from 'node:fs';
        import { stdout } from 'node:process';
        const {
          createHmac,
        } = await import('node:crypto');
        
        const hmac = createHmac('sha256', 'a secret');
        
        const input = createReadStream('test.js');
        input.pipe(hmac).pipe(stdout);const {
          createReadStream,
        } = require('node:fs');
        const {
          createHmac,
        } = require('node:crypto');
        const { stdout } = require('node:process');
        
        const hmac = createHmac('sha256', 'a secret');
        
        const input = createReadStream('test.js');
        input.pipe(hmac).pipe(stdout);
        32

      import { createReadStream } from 'node:fs';
      import { stdout } from 'node:process';
      const {
        createHmac,
      } = await import('node:crypto');
      
      const hmac = createHmac('sha256', 'a secret');
      
      const input = createReadStream('test.js');
      input.pipe(hmac).pipe(stdout);const {
        createReadStream,
      } = require('node:fs');
      const {
        createHmac,
      } = require('node:crypto');
      const { stdout } = require('node:process');
      
      const hmac = createHmac('sha256', 'a secret');
      
      const input = createReadStream('test.js');
      input.pipe(hmac).pipe(stdout);
      33 will use MGF1 with the same hash function used to verify the message as specified in section 3. 1 of RFC 4055, unless an MGF1 hash function has been specified as part of the key in compliance with section 3. 3 of RFC 4055

    • import { createReadStream } from 'node:fs';
      import { stdout } from 'node:process';
      const { createHash } = await import('node:crypto');
      
      const hash = createHash('sha256');
      
      const input = createReadStream('test.js');
      input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
      const { createHash } = require('node:crypto');
      const { stdout } = require('node:process');
      
      const hash = createHash('sha256');
      
      const input = createReadStream('test.js');
      input.pipe(hash).setEncoding('hex').pipe(stdout);
      39 Salt length for when padding is
      import { createReadStream } from 'node:fs';
      import { stdout } from 'node:process';
      const {
        createHmac,
      } = await import('node:crypto');
      
      const hmac = createHmac('sha256', 'a secret');
      
      const input = createReadStream('test.js');
      input.pipe(hmac).pipe(stdout);const {
        createReadStream,
      } = require('node:fs');
      const {
        createHmac,
      } = require('node:crypto');
      const { stdout } = require('node:process');
      
      const hmac = createHmac('sha256', 'a secret');
      
      const input = createReadStream('test.js');
      input.pipe(hmac).pipe(stdout);
      33. The special value
      import { createReadStream } from 'node:fs';
      import { stdout } from 'node:process';
      const {
        createHmac,
      } = await import('node:crypto');
      
      const hmac = createHmac('sha256', 'a secret');
      
      const input = createReadStream('test.js');
      input.pipe(hmac).pipe(stdout);const {
        createReadStream,
      } = require('node:fs');
      const {
        createHmac,
      } = require('node:crypto');
      const { stdout } = require('node:process');
      
      const hmac = createHmac('sha256', 'a secret');
      
      const input = createReadStream('test.js');
      input.pipe(hmac).pipe(stdout);
      36 sets the salt length to the digest size,
      import { createReadStream } from 'node:fs';
      import { stdout } from 'node:process';
      const {
        createHmac,
      } = await import('node:crypto');
      
      const hmac = createHmac('sha256', 'a secret');
      
      const input = createReadStream('test.js');
      input.pipe(hmac).pipe(stdout);const {
        createReadStream,
      } = require('node:fs');
      const {
        createHmac,
      } = require('node:crypto');
      const { stdout } = require('node:process');
      
      const hmac = createHmac('sha256', 'a secret');
      
      const input = createReadStream('test.js');
      input.pipe(hmac).pipe(stdout);
      99 (default) causes it to be determined automatically

    The

    import { createReadStream } from 'node:fs';
    import { stdout } from 'node:process';
    const {
      createHmac,
    } = await import('node:crypto');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);const {
      createReadStream,
    } = require('node:fs');
    const {
      createHmac,
    } = require('node:crypto');
    const { stdout } = require('node:process');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);
    82 argument is the previously calculated signature for the data, in the
    const { X509Certificate } = await import('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);
    01. If a
    const { X509Certificate } = await import('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);
    01 is specified, the
    import { createReadStream } from 'node:fs';
    import { stdout } from 'node:process';
    const {
      createHmac,
    } = await import('node:crypto');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);const {
      createReadStream,
    } = require('node:fs');
    const {
      createHmac,
    } = require('node:crypto');
    const { stdout } = require('node:process');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);
    82 is expected to be a string; otherwise
    import { createReadStream } from 'node:fs';
    import { stdout } from 'node:process';
    const {
      createHmac,
    } = await import('node:crypto');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);const {
      createReadStream,
    } = require('node:fs');
    const {
      createHmac,
    } = require('node:crypto');
    const { stdout } = require('node:process');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);
    82 is expected to be a
    import { createReadStream } from 'node:fs';
    import { stdout } from 'node:process';
    const {
      createHmac,
    } = await import('node:crypto');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);const {
      createReadStream,
    } = require('node:fs');
    const {
      createHmac,
    } = require('node:crypto');
    const { stdout } = require('node:process');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);
    3,
    let crypto;
    try {
      crypto = await import('node:crypto');
    } catch (err) {
      console.error('crypto support is disabled!');
    }
    01, or
    let crypto;
    try {
      crypto = await import('node:crypto');
    } catch (err) {
      console.error('crypto support is disabled!');
    }
    02

    The

    const { X509Certificate } = await import('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);
    08 object can not be used again after
    const { X509Certificate } = await import('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);
    09 has been called. Multiple calls to
    const { X509Certificate } = await import('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);
    09 will result in an error being thrown

    Because public keys can be derived from private keys, a private key may be passed instead of a public key

    Class. const { X509Certificate } = await import('node:crypto'); const x509 = new X509Certificate('{.. pem encoded cert ...}'); console.log(x509.subject);const { X509Certificate } = require('node:crypto'); const x509 = new X509Certificate('{.. pem encoded cert ...}'); console.log(x509.subject);11

    Encapsulates an X509 certificate and provides read-only access to its information

    const { X509Certificate } = await import('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);

    const { X509Certificate } = await import('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);
    12

    const { X509Certificate } = await import('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);
    13

    • Type. Will be
      import { createReadStream } from 'node:fs';
      import { stdout } from 'node:process';
      const { createHash } = await import('node:crypto');
      
      const hash = createHash('sha256');
      
      const input = createReadStream('test.js');
      input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
      const { createHash } = require('node:crypto');
      const { stdout } = require('node:process');
      
      const hash = createHash('sha256');
      
      const input = createReadStream('test.js');
      input.pipe(hash).setEncoding('hex').pipe(stdout);
      99 if this is a Certificate Authority (CA) certificate

    const { X509Certificate } = await import('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);
    15

    HistoryVersionChangesv18. 0. 0

    The subject option now defaults to

    const { X509Certificate } = await import('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);
    16

    v17. 5. 0, v16. 15. 0

    The subject option can now be set to

    const { X509Certificate } = await import('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);
    16

    v17. 5. 0, v16. 14. 1

    The

    const { X509Certificate } = await import('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);
    18,
    const { X509Certificate } = await import('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);
    19,
    const { X509Certificate } = await import('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);
    20, and
    const { X509Certificate } = await import('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);
    21 options have been removed since they had no effect

    v15. 6. 0

    Added in. v15. 6. 0

    Periksa apakah sertifikat cocok dengan alamat email yang diberikan

    Jika opsi

    const { X509Certificate } = await import('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);
    22 tidak ditentukan atau disetel ke
    const { X509Certificate } = await import('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);
    16, subjek sertifikat hanya dipertimbangkan jika ekstensi nama alternatif subjek tidak ada atau tidak berisi alamat email apa pun

    Jika opsi

    const { X509Certificate } = await import('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);
    22 disetel ke
    const { X509Certificate } = await import('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);
    25 dan jika ekstensi nama alternatif subjek tidak ada atau tidak berisi alamat email yang cocok, subjek sertifikat dianggap

    Jika opsi

    const { X509Certificate } = await import('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);
    22 disetel ke
    const { X509Certificate } = await import('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);
    27, subjek sertifikat tidak pernah dipertimbangkan, meskipun sertifikat tidak berisi nama alternatif subjek

    const { X509Certificate } = await import('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);
    _28

    HistoryVersionChangesv18. 0. 0

    The subject option now defaults to

    const { X509Certificate } = await import('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);
    16

    v17. 5. 0, v16. 15. 0

    The subject option can now be set to

    const { X509Certificate } = await import('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);
    16

    v15. 6. 0

    Added in. v15. 6. 0

    Memeriksa apakah sertifikat cocok dengan nama host yang diberikan

    Jika sertifikat cocok dengan nama host yang diberikan, nama subjek yang cocok dikembalikan. Nama yang dikembalikan mungkin sama persis (dan. g. ,

    const { X509Certificate } = await import('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);
    31) atau mungkin berisi karakter pengganti (dan. g. ,
    const { X509Certificate } = await import('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);
    _32). Karena perbandingan nama host tidak peka huruf besar/kecil, nama subjek yang dikembalikan mungkin juga berbeda dari
    const { X509Certificate } = await import('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);
    33 yang diberikan dalam kapitalisasi

    If the

    const { X509Certificate } = await import('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);
    22 option is undefined or set to
    const { X509Certificate } = await import('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);
    16, the certificate subject is only considered if the subject alternative name extension either does not exist or does not contain any DNS names. Perilaku ini konsisten dengan RFC 2818 ("HTTP Over TLS")

    If the

    const { X509Certificate } = await import('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);
    22 option is set to
    const { X509Certificate } = await import('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);
    25 and if the subject alternative name extension either does not exist or does not contain a matching DNS name, the certificate subject is considered

    Jika opsi

    const { X509Certificate } = await import('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);
    22 disetel ke
    const { X509Certificate } = await import('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);
    27, subjek sertifikat tidak pernah dipertimbangkan, meskipun sertifikat tidak berisi nama alternatif subjek

    const { X509Certificate } = await import('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);
    _40

    HistoryVersionChangesv17. 5. 0, v16. 14. 1

    The

    let crypto;
    try {
      crypto = await import('node:crypto');
    } catch (err) {
      console.error('crypto support is disabled!');
    }
    44 argument has been removed since it had no effect

    v15. 6. 0

    Added in. v15. 6. 0

    Checks whether the certificate matches the given IP address (IPv4 or IPv6)

    Only RFC 5280

    const { X509Certificate } = await import('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);
    42 subject alternative names are considered, and they must match the given
    const { X509Certificate } = await import('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);
    43 address exactly. Other subject alternative names as well as the subject field of the certificate are ignored

    const { X509Certificate } = await import('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);
    44

    Checks whether this certificate was issued by the given

    const { X509Certificate } = await import('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);
    45

    const { X509Certificate } = await import('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);
    46

    Checks whether the public key for this certificate is consistent with the given private key

    const { X509Certificate } = await import('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);
    47

    The SHA-1 fingerprint of this certificate

    Because SHA-1 is cryptographically broken and because the security of SHA-1 is significantly worse than that of algorithms that are commonly used to sign certificates, consider using instead

    const { X509Certificate } = await import('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);
    48

    The SHA-256 fingerprint of this certificate

    const { X509Certificate } = await import('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);
    50

    Added in. v17. 2. 0, v16. 14. 0

    The SHA-512 fingerprint of this certificate

    Because computing the SHA-256 fingerprint is usually faster and because it is only half the size of the SHA-512 fingerprint, may be a better choice. While SHA-512 presumably provides a higher level of security in general, the security of SHA-256 matches that of most algorithms that are commonly used to sign certificates

    const { X509Certificate } = await import('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);
    52

    HistoryVersionChangesv17. 3. 1, v16. 13. 2

    Parts of this string may be encoded as JSON string literals in response to CVE-2021-44532

    v15. 6. 0

    Added in. v15. 6. 0

    A textual representation of the certificate's authority information access extension

    This is a line feed separated list of access descriptions. Each line begins with the access method and the kind of the access location, followed by a colon and the value associated with the access location

    After the prefix denoting the access method and the kind of the access location, the remainder of each line might be enclosed in quotes to indicate that the value is a JSON string literal. For backward compatibility, Node. js only uses JSON string literals within this property when necessary to avoid ambiguity. Third-party code should be prepared to handle both possible entry formats

    const { X509Certificate } = await import('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);
    53

    The issuer identification included in this certificate

    const { X509Certificate } = await import('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);
    54

    The issuer certificate or

    import { createReadStream } from 'node:fs';
    import { stdout } from 'node:process';
    const { createHash } = await import('node:crypto');
    
    const hash = createHash('sha256');
    
    const input = createReadStream('test.js');
    input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
    const { createHash } = require('node:crypto');
    const { stdout } = require('node:process');
    
    const hash = createHash('sha256');
    
    const input = createReadStream('test.js');
    input.pipe(hash).setEncoding('hex').pipe(stdout);
    50 if the issuer certificate is not available

    const { X509Certificate } = await import('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);
    56

    An array detailing the key usages for this certificate

    const { X509Certificate } = await import('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);
    _57

    Kunci publik untuk sertifikat ini

    const { X509Certificate } = await import('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);
    58

    A

    import { createReadStream } from 'node:fs';
    import { stdout } from 'node:process';
    const {
      createHmac,
    } = await import('node:crypto');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);const {
      createReadStream,
    } = require('node:fs');
    const {
      createHmac,
    } = require('node:crypto');
    const { stdout } = require('node:process');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);
    3 containing the DER encoding of this certificate

    const { X509Certificate } = await import('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);
    60

    The serial number of this certificate

    Serial numbers are assigned by certificate authorities and do not uniquely identify certificates. Consider using as a unique identifier instead

    const { X509Certificate } = await import('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);
    62

    The complete subject of this certificate

    const { X509Certificate } = await import('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);
    63

    HistoryVersionChangesv17. 3. 1, v16. 13. 2

    Parts of this string may be encoded as JSON string literals in response to CVE-2021-44532

    v15. 6. 0

    Added in. v15. 6. 0

    The subject alternative name specified for this certificate

    This is a comma-separated list of subject alternative names. Each entry begins with a string identifying the kind of the subject alternative name followed by a colon and the value associated with the entry

    Earlier versions of Node. js salah berasumsi bahwa aman untuk membagi properti ini pada urutan dua karakter

    const { X509Certificate } = await import('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);
    64 (lihat CVE-2021-44532). However, both malicious and legitimate certificates can contain subject alternative names that include this sequence when represented as a string

    After the prefix denoting the type of the entry, the remainder of each entry might be enclosed in quotes to indicate that the value is a JSON string literal. For backward compatibility, Node. js only uses JSON string literals within this property when necessary to avoid ambiguity. Third-party code should be prepared to handle both possible entry formats

    const { X509Certificate } = await import('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);
    65

    There is no standard JSON encoding for X509 certificates. The

    const { X509Certificate } = await import('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);
    66 method returns a string containing the PEM encoded certificate

    const { X509Certificate } = await import('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);
    67

    Returns information about this certificate using the legacy encoding

    const { X509Certificate } = await import('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);
    68

    Returns the PEM-encoded certificate

    const { X509Certificate } = await import('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);
    69

    The date/time from which this certificate is considered valid

    const { X509Certificate } = await import('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);
    70

    The date/time until which this certificate is considered valid

    const { X509Certificate } = await import('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);
    71

    Verifies that this certificate was signed by the given public key. Does not perform any other validation checks on the certificate

    let crypto; try { crypto = await import('node:crypto'); } catch (err) { console.error('crypto support is disabled!'); }0 module methods and properties

    const { X509Certificate } = await import('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);
    73

    An object containing commonly used constants for crypto and security related operations. The specific constants currently defined are described in

    const { X509Certificate } = await import('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);
    74

    Added in. v0. 9. 3Deprecated since. v10. 0. 0

    The default encoding to use for functions that can take either strings or buffers. The default value is

    import { createReadStream } from 'node:fs';
    import { stdout } from 'node:process';
    const { createHash } = await import('node:crypto');
    
    const hash = createHash('sha256');
    
    const input = createReadStream('test.js');
    input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
    const { createHash } = require('node:crypto');
    const { stdout } = require('node:process');
    
    const hash = createHash('sha256');
    
    const input = createReadStream('test.js');
    input.pipe(hash).setEncoding('hex').pipe(stdout);
    69, which makes methods default to
    import { createReadStream } from 'node:fs';
    import { stdout } from 'node:process';
    const {
      createHmac,
    } = await import('node:crypto');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);const {
      createReadStream,
    } = require('node:fs');
    const {
      createHmac,
    } = require('node:crypto');
    const { stdout } = require('node:process');
    
    const hmac = createHmac('sha256', 'a secret');
    
    const input = createReadStream('test.js');
    input.pipe(hmac).pipe(stdout);
    3 objects

    The

    const { X509Certificate } = await import('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);
    74 mechanism is provided for backward compatibility with legacy programs that expect
    const { X509Certificate } = await import('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);
    78 to be the default encoding

    New applications should expect the default to be

    import { createReadStream } from 'node:fs';
    import { stdout } from 'node:process';
    const { createHash } = await import('node:crypto');
    
    const hash = createHash('sha256');
    
    const input = createReadStream('test.js');
    input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
    const { createHash } = require('node:crypto');
    const { stdout } = require('node:process');
    
    const hash = createHash('sha256');
    
    const input = createReadStream('test.js');
    input.pipe(hash).setEncoding('hex').pipe(stdout);
    69

    This property is deprecated

    const { X509Certificate } = await import('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);
    80

    Added in. v6. 0. 0Deprecated since. v10. 0. 0

    Property for checking and controlling whether a FIPS compliant crypto provider is currently in use. Setting to true requires a FIPS build of Node. js

    This property is deprecated. Please use

    const { X509Certificate } = await import('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);
    81 and
    const { X509Certificate } = await import('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);
    82 instead

    const { X509Certificate } = await import('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);
    83

    HistoryVersionChangesv18. 0. 0

    Melewati panggilan balik yang tidak valid ke argumen

    const { X509Certificate } = await import('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);
    84 sekarang melempar
    const { X509Certificate } = await import('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);
    85 alih-alih
    const { X509Certificate } = await import('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
    
    const x509 = new X509Certificate('{.. pem encoded cert ...}');
    
    console.log(x509.subject);
    86

    v15. 8. 0

    Added in. v15. 8. 0

    • const { X509Certificate } = await import('node:crypto');
      
      const x509 = new X509Certificate('{.. pem encoded cert ...}');
      
      console.log(x509.subject);const { X509Certificate } = require('node:crypto');
      
      const x509 = new X509Certificate('{.. pem encoded cert ...}');
      
      console.log(x509.subject);
      87 . . . . . A possible prime encoded as a sequence of big endian octets of arbitrary length
    • let crypto;
      try {
        crypto = await import('node:crypto');
      } catch (err) {
        console.error('crypto support is disabled!');
      }
      44
      • const { X509Certificate } = await import('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);const { X509Certificate } = require('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);
        89 The number of Miller-Rabin probabilistic primality iterations to perform. When the value is
        const { X509Certificate } = await import('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);const { X509Certificate } = require('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);
        90 (zero), a number of checks is used that yields a false positive rate of at most 2-64 for random input. Care must be used when selecting a number of checks. Refer to the OpenSSL documentation for the
        const { X509Certificate } = await import('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);const { X509Certificate } = require('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);
        91 function
        const { X509Certificate } = await import('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);const { X509Certificate } = require('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);
        92 options for more details. Default.
        const { X509Certificate } = await import('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);const { X509Certificate } = require('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);
        90
    • const { X509Certificate } = await import('node:crypto');
      
      const x509 = new X509Certificate('{.. pem encoded cert ...}');
      
      console.log(x509.subject);const { X509Certificate } = require('node:crypto');
      
      const x509 = new X509Certificate('{.. pem encoded cert ...}');
      
      console.log(x509.subject);
      _84
      • const { X509Certificate } = await import('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);const { X509Certificate } = require('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);
        95 Set to an object if an error occurred during check
      • const { X509Certificate } = await import('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);const { X509Certificate } = require('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);
        96
        import { createReadStream } from 'node:fs';
        import { stdout } from 'node:process';
        const { createHash } = await import('node:crypto');
        
        const hash = createHash('sha256');
        
        const input = createReadStream('test.js');
        input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
        const { createHash } = require('node:crypto');
        const { stdout } = require('node:process');
        
        const hash = createHash('sha256');
        
        const input = createReadStream('test.js');
        input.pipe(hash).setEncoding('hex').pipe(stdout);
        99 if the candidate is a prime with an error probability less than
        const { X509Certificate } = await import('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);const { X509Certificate } = require('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);
        98
    • Checks the primality of the

      const { X509Certificate } = await import('node:crypto');
      
      const x509 = new X509Certificate('{.. pem encoded cert ...}');
      
      console.log(x509.subject);const { X509Certificate } = require('node:crypto');
      
      const x509 = new X509Certificate('{.. pem encoded cert ...}');
      
      console.log(x509.subject);
      87

      const {
        generateKeyPairSync,
      } = await import('node:crypto');
      
      const {
        publicKey,
        privateKey,
      } = generateKeyPairSync('rsa', {
        modulusLength: 4096,
        publicKeyEncoding: {
          type: 'spki',
          format: 'pem',
        },
        privateKeyEncoding: {
          type: 'pkcs8',
          format: 'pem',
          cipher: 'aes-256-cbc',
          passphrase: 'top secret',
        },
      });const {
        generateKeyPairSync,
      } = require('node:crypto');
      
      const {
        publicKey,
        privateKey,
      } = generateKeyPairSync('rsa', {
        modulusLength: 4096,
        publicKeyEncoding: {
          type: 'spki',
          format: 'pem',
        },
        privateKeyEncoding: {
          type: 'pkcs8',
          format: 'pem',
          cipher: 'aes-256-cbc',
          passphrase: 'top secret',
        },
      });
      00

      • const { X509Certificate } = await import('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);const { X509Certificate } = require('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);
        87 . . . . . A possible prime encoded as a sequence of big endian octets of arbitrary length
      • let crypto;
        try {
          crypto = await import('node:crypto');
        } catch (err) {
          console.error('crypto support is disabled!');
        }
        44
        • const { X509Certificate } = await import('node:crypto');
          
          const x509 = new X509Certificate('{.. pem encoded cert ...}');
          
          console.log(x509.subject);const { X509Certificate } = require('node:crypto');
          
          const x509 = new X509Certificate('{.. pem encoded cert ...}');
          
          console.log(x509.subject);
          89 The number of Miller-Rabin probabilistic primality iterations to perform. When the value is
          const { X509Certificate } = await import('node:crypto');
          
          const x509 = new X509Certificate('{.. pem encoded cert ...}');
          
          console.log(x509.subject);const { X509Certificate } = require('node:crypto');
          
          const x509 = new X509Certificate('{.. pem encoded cert ...}');
          
          console.log(x509.subject);
          90 (zero), a number of checks is used that yields a false positive rate of at most 2-64 for random input. Care must be used when selecting a number of checks. Refer to the OpenSSL documentation for the
          const { X509Certificate } = await import('node:crypto');
          
          const x509 = new X509Certificate('{.. pem encoded cert ...}');
          
          console.log(x509.subject);const { X509Certificate } = require('node:crypto');
          
          const x509 = new X509Certificate('{.. pem encoded cert ...}');
          
          console.log(x509.subject);
          91 function
          const { X509Certificate } = await import('node:crypto');
          
          const x509 = new X509Certificate('{.. pem encoded cert ...}');
          
          console.log(x509.subject);const { X509Certificate } = require('node:crypto');
          
          const x509 = new X509Certificate('{.. pem encoded cert ...}');
          
          console.log(x509.subject);
          92 options for more details. Default.
          const { X509Certificate } = await import('node:crypto');
          
          const x509 = new X509Certificate('{.. pem encoded cert ...}');
          
          console.log(x509.subject);const { X509Certificate } = require('node:crypto');
          
          const x509 = new X509Certificate('{.. pem encoded cert ...}');
          
          console.log(x509.subject);
          90
      • Returns.
        import { createReadStream } from 'node:fs';
        import { stdout } from 'node:process';
        const { createHash } = await import('node:crypto');
        
        const hash = createHash('sha256');
        
        const input = createReadStream('test.js');
        input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
        const { createHash } = require('node:crypto');
        const { stdout } = require('node:process');
        
        const hash = createHash('sha256');
        
        const input = createReadStream('test.js');
        input.pipe(hash).setEncoding('hex').pipe(stdout);
        99 if the candidate is a prime with an error probability less than
        const { X509Certificate } = await import('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);const { X509Certificate } = require('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);
        98
      • Checks the primality of the

        const { X509Certificate } = await import('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);const { X509Certificate } = require('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);
        87

        const {
          generateKeyPairSync,
        } = await import('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });const {
          generateKeyPairSync,
        } = require('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });
        11

        HistoryVersionChangesv17. 9. 0, v16. 17. 0

        The

        const { X509Certificate } = await import('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);const { X509Certificate } = require('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);
        6 option is now optional when using the
        const { X509Certificate } = await import('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);const { X509Certificate } = require('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);
        1 cipher and defaults to 16 bytes

        v15. 0. 0

        The password argument can be an ArrayBuffer and is limited to a maximum of 2 ** 31 - 1 bytes

        v10. 10. 0

        Ciphers in OCB mode are now supported

        v10. 2. 0

        The

        const { X509Certificate } = await import('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);const { X509Certificate } = require('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);
        6 option can now be used to produce shorter authentication tags in GCM mode and defaults to 16 bytes

        v10. 0. 0

        Deprecated since. v10. 0. 0

        v0. 1. 94

        ditambahkan. v0. 1. 94

        Creates and returns a

        const { createDiffieHellmanGroup } = await import('node:crypto');
        const dh = createDiffieHellmanGroup('modp16');const { createDiffieHellmanGroup } = require('node:crypto');
        const dh = createDiffieHellmanGroup('modp16');
        6 object that uses the given
        const {
          generateKeyPairSync,
        } = await import('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });const {
          generateKeyPairSync,
        } = require('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });
        16 and
        const {
          generateKeyPairSync,
        } = await import('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });const {
          generateKeyPairSync,
        } = require('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });
        17

        The

        let crypto;
        try {
          crypto = await import('node:crypto');
        } catch (err) {
          console.error('crypto support is disabled!');
        }
        44 argument controls stream behavior and is optional except when a cipher in CCM or OCB mode (e. g.
        const {
          generateKeyPairSync,
        } = await import('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });const {
          generateKeyPairSync,
        } = require('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });
        19) is used. In that case, the
        const { X509Certificate } = await import('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);const { X509Certificate } = require('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);
        6 option is required and specifies the length of the authentication tag in bytes, see . In GCM mode, the
        const { X509Certificate } = await import('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);const { X509Certificate } = require('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);
        6 option is not required but can be used to set the length of the authentication tag that will be returned by
        const {
          generateKeyPairSync,
        } = await import('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });const {
          generateKeyPairSync,
        } = require('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });
        22 and defaults to 16 bytes. For
        const { X509Certificate } = await import('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);const { X509Certificate } = require('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);
        1, the
        const { X509Certificate } = await import('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);const { X509Certificate } = require('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);
        6 option defaults to 16 bytes

        The

        const {
          generateKeyPairSync,
        } = await import('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });const {
          generateKeyPairSync,
        } = require('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });
        16 is dependent on OpenSSL, examples are
        const {
          generateKeyPairSync,
        } = await import('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });const {
          generateKeyPairSync,
        } = require('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });
        26, etc. On recent OpenSSL releases,
        const {
          generateKeyPairSync,
        } = await import('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });const {
          generateKeyPairSync,
        } = require('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });
        27 will display the available cipher algorithms

        The

        const {
          generateKeyPairSync,
        } = await import('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });const {
          generateKeyPairSync,
        } = require('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });
        17 is used to derive the cipher key and initialization vector (IV). The value must be either a
        const { X509Certificate } = await import('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);const { X509Certificate } = require('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);
        78 encoded string, a
        import { createReadStream } from 'node:fs';
        import { stdout } from 'node:process';
        const {
          createHmac,
        } = await import('node:crypto');
        
        const hmac = createHmac('sha256', 'a secret');
        
        const input = createReadStream('test.js');
        input.pipe(hmac).pipe(stdout);const {
          createReadStream,
        } = require('node:fs');
        const {
          createHmac,
        } = require('node:crypto');
        const { stdout } = require('node:process');
        
        const hmac = createHmac('sha256', 'a secret');
        
        const input = createReadStream('test.js');
        input.pipe(hmac).pipe(stdout);
        3, a
        let crypto;
        try {
          crypto = await import('node:crypto');
        } catch (err) {
          console.error('crypto support is disabled!');
        }
        01, or a
        let crypto;
        try {
          crypto = await import('node:crypto');
        } catch (err) {
          console.error('crypto support is disabled!');
        }
        02

        This function is semantically insecure for all supported ciphers and fatally flawed for ciphers in counter mode (such as CTR, GCM, or CCM)

        The implementation of

        import { createReadStream } from 'node:fs';
        import { stdout } from 'node:process';
        const { createHash } = await import('node:crypto');
        
        const hash = createHash('sha256');
        
        const input = createReadStream('test.js');
        input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
        const { createHash } = require('node:crypto');
        const { stdout } = require('node:process');
        
        const hash = createHash('sha256');
        
        const input = createReadStream('test.js');
        input.pipe(hash).setEncoding('hex').pipe(stdout);
        0 derives keys using the OpenSSL function
        const {
          generateKeyPairSync,
        } = await import('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });const {
          generateKeyPairSync,
        } = require('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });
        34 with the digest algorithm set to MD5, one iteration, and no salt. The lack of salt allows dictionary attacks as the same password always creates the same key. The low iteration count and non-cryptographically secure hash algorithm allow passwords to be tested very rapidly

        In line with OpenSSL's recommendation to use a more modern algorithm instead of

        const {
          generateKeyPairSync,
        } = await import('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });const {
          generateKeyPairSync,
        } = require('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });
        34 it is recommended that developers derive a key and IV on their own using and to use to create the
        const { createDiffieHellmanGroup } = await import('node:crypto');
        const dh = createDiffieHellmanGroup('modp16');const { createDiffieHellmanGroup } = require('node:crypto');
        const dh = createDiffieHellmanGroup('modp16');
        6 object. Users should not use ciphers with counter mode (e. g. CTR, GCM, or CCM) in
        import { createReadStream } from 'node:fs';
        import { stdout } from 'node:process';
        const { createHash } = await import('node:crypto');
        
        const hash = createHash('sha256');
        
        const input = createReadStream('test.js');
        input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
        const { createHash } = require('node:crypto');
        const { stdout } = require('node:process');
        
        const hash = createHash('sha256');
        
        const input = createReadStream('test.js');
        input.pipe(hash).setEncoding('hex').pipe(stdout);
        0. A warning is emitted when they are used in order to avoid the risk of IV reuse that causes vulnerabilities. For the case when IV is reused in GCM, see Nonce-Disrespecting Adversaries for details

        const {
          generateKeyPairSync,
        } = await import('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });const {
          generateKeyPairSync,
        } = require('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });
        40

        HistoryVersionChangesv17. 9. 0, v16. 17. 0

        The

        const { X509Certificate } = await import('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);const { X509Certificate } = require('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);
        6 option is now optional when using the
        const { X509Certificate } = await import('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);const { X509Certificate } = require('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);
        1 cipher and defaults to 16 bytes

        v15. 0. 0

        The password and iv arguments can be an ArrayBuffer and are each limited to a maximum of 2 ** 31 - 1 bytes

        v11. 6. 0

        The

        const { Certificate } = await import('node:crypto');
        
        const cert1 = new Certificate();
        const cert2 = Certificate();const { Certificate } = require('node:crypto');
        
        const cert1 = new Certificate();
        const cert2 = Certificate();
        63 argument can now be a
        import { createReadStream } from 'node:fs';
        import { stdout } from 'node:process';
        const { createHash } = await import('node:crypto');
        
        const hash = createHash('sha256');
        
        const input = createReadStream('test.js');
        input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
        const { createHash } = require('node:crypto');
        const { stdout } = require('node:process');
        
        const hash = createHash('sha256');
        
        const input = createReadStream('test.js');
        input.pipe(hash).setEncoding('hex').pipe(stdout);
        14

        v11. 2. 0, v10. 17. 0

        The cipher

        const { X509Certificate } = await import('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);const { X509Certificate } = require('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);
        1 (the IETF variant of ChaCha20-Poly1305) is now supported

        v10. 10. 0

        Ciphers in OCB mode are now supported

        v10. 2. 0

        The

        const { X509Certificate } = await import('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);const { X509Certificate } = require('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);
        6 option can now be used to produce shorter authentication tags in GCM mode and defaults to 16 bytes

        v9. 9. 0

        The

        const {
          generateKeyPairSync,
        } = await import('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });const {
          generateKeyPairSync,
        } = require('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });
        47 parameter may now be
        const {
          generateKeyPairSync,
        } = await import('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });const {
          generateKeyPairSync,
        } = require('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });
        48 for ciphers which do not need an initialization vector

        v0. 1. 94

        ditambahkan. v0. 1. 94

        Creates and returns a

        const { createDiffieHellmanGroup } = await import('node:crypto');
        const dh = createDiffieHellmanGroup('modp16');const { createDiffieHellmanGroup } = require('node:crypto');
        const dh = createDiffieHellmanGroup('modp16');
        6 object, with the given
        const {
          generateKeyPairSync,
        } = await import('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });const {
          generateKeyPairSync,
        } = require('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });
        16,
        const { Certificate } = await import('node:crypto');
        
        const cert1 = new Certificate();
        const cert2 = Certificate();const { Certificate } = require('node:crypto');
        
        const cert1 = new Certificate();
        const cert2 = Certificate();
        63 and initialization vector (
        const {
          generateKeyPairSync,
        } = await import('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });const {
          generateKeyPairSync,
        } = require('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });
        47)

        The

        let crypto;
        try {
          crypto = await import('node:crypto');
        } catch (err) {
          console.error('crypto support is disabled!');
        }
        44 argument controls stream behavior and is optional except when a cipher in CCM or OCB mode (e. g.
        const {
          generateKeyPairSync,
        } = await import('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });const {
          generateKeyPairSync,
        } = require('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });
        19) is used. In that case, the
        const { X509Certificate } = await import('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);const { X509Certificate } = require('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);
        6 option is required and specifies the length of the authentication tag in bytes, see . In GCM mode, the
        const { X509Certificate } = await import('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);const { X509Certificate } = require('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);
        6 option is not required but can be used to set the length of the authentication tag that will be returned by
        const {
          generateKeyPairSync,
        } = await import('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });const {
          generateKeyPairSync,
        } = require('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });
        22 and defaults to 16 bytes. For
        const { X509Certificate } = await import('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);const { X509Certificate } = require('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);
        1, the
        const { X509Certificate } = await import('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);const { X509Certificate } = require('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);
        6 option defaults to 16 bytes

        The

        const {
          generateKeyPairSync,
        } = await import('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });const {
          generateKeyPairSync,
        } = require('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });
        16 is dependent on OpenSSL, examples are
        const {
          generateKeyPairSync,
        } = await import('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });const {
          generateKeyPairSync,
        } = require('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });
        26, etc. On recent OpenSSL releases,
        const {
          generateKeyPairSync,
        } = await import('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });const {
          generateKeyPairSync,
        } = require('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });
        27 will display the available cipher algorithms

        The

        const { Certificate } = await import('node:crypto');
        
        const cert1 = new Certificate();
        const cert2 = Certificate();const { Certificate } = require('node:crypto');
        
        const cert1 = new Certificate();
        const cert2 = Certificate();
        63 is the raw key used by the
        const {
          generateKeyPairSync,
        } = await import('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });const {
          generateKeyPairSync,
        } = require('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });
        16 and
        const {
          generateKeyPairSync,
        } = await import('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });const {
          generateKeyPairSync,
        } = require('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });
        47 is an initialization vector. Both arguments must be
        const { createDiffieHellmanGroup } = await import('node:crypto');
        const dh = createDiffieHellmanGroup('modp16');const { createDiffieHellmanGroup } = require('node:crypto');
        const dh = createDiffieHellmanGroup('modp16');
        74 encoded strings, Buffers,
        let crypto;
        try {
          crypto = await import('node:crypto');
        } catch (err) {
          console.error('crypto support is disabled!');
        }
        01, or
        let crypto;
        try {
          crypto = await import('node:crypto');
        } catch (err) {
          console.error('crypto support is disabled!');
        }
        02s. The
        const { Certificate } = await import('node:crypto');
        
        const cert1 = new Certificate();
        const cert2 = Certificate();const { Certificate } = require('node:crypto');
        
        const cert1 = new Certificate();
        const cert2 = Certificate();
        63 may optionally be a of type
        const {
          generateKeyPairSync,
        } = await import('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });const {
          generateKeyPairSync,
        } = require('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });
        71. If the cipher does not need an initialization vector,
        const {
          generateKeyPairSync,
        } = await import('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });const {
          generateKeyPairSync,
        } = require('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });
        47 may be
        const {
          generateKeyPairSync,
        } = await import('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });const {
          generateKeyPairSync,
        } = require('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });
        48

        When passing strings for

        const { Certificate } = await import('node:crypto');
        
        const cert1 = new Certificate();
        const cert2 = Certificate();const { Certificate } = require('node:crypto');
        
        const cert1 = new Certificate();
        const cert2 = Certificate();
        63 or
        const {
          generateKeyPairSync,
        } = await import('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });const {
          generateKeyPairSync,
        } = require('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });
        47, please consider

        Vektor inisialisasi harus tidak dapat diprediksi dan unik; . They do not have to be secret. IVs are typically just added to ciphertext messages unencrypted. It may sound contradictory that something has to be unpredictable and unique, but does not have to be secret; remember that an attacker must not be able to predict ahead of time what a given IV will be

        const {
          generateKeyPairSync,
        } = await import('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });const {
          generateKeyPairSync,
        } = require('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });
        76

        HistoryVersionChangesv17. 9. 0, v16. 17. 0

        The

        const { X509Certificate } = await import('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);const { X509Certificate } = require('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);
        6 option is now optional when using the
        const { X509Certificate } = await import('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);const { X509Certificate } = require('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);
        1 cipher and defaults to 16 bytes

        v10. 10. 0

        Ciphers in OCB mode are now supported

        v10. 0. 0

        Deprecated since. v10. 0. 0

        v0. 1. 94

        ditambahkan. v0. 1. 94

        Creates and returns a

        let crypto;
        try {
          crypto = await import('node:crypto');
        } catch (err) {
          console.error('crypto support is disabled!');
        }
        16 object that uses the given
        const {
          generateKeyPairSync,
        } = await import('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });const {
          generateKeyPairSync,
        } = require('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });
        16 and
        const {
          generateKeyPairSync,
        } = await import('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });const {
          generateKeyPairSync,
        } = require('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });
        17 (key)

        The

        let crypto;
        try {
          crypto = await import('node:crypto');
        } catch (err) {
          console.error('crypto support is disabled!');
        }
        44 argument controls stream behavior and is optional except when a cipher in CCM or OCB mode (e. g.
        const {
          generateKeyPairSync,
        } = await import('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });const {
          generateKeyPairSync,
        } = require('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });
        19) is used. In that case, the
        const { X509Certificate } = await import('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);const { X509Certificate } = require('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);
        6 option is required and specifies the length of the authentication tag in bytes, see . For
        const { X509Certificate } = await import('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);const { X509Certificate } = require('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);
        1, the
        const { X509Certificate } = await import('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);const { X509Certificate } = require('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);
        6 option defaults to 16 bytes

        This function is semantically insecure for all supported ciphers and fatally flawed for ciphers in counter mode (such as CTR, GCM, or CCM)

        The implementation of

        let crypto;
        try {
          crypto = await import('node:crypto');
        } catch (err) {
          console.error('crypto support is disabled!');
        }
        20 derives keys using the OpenSSL function
        const {
          generateKeyPairSync,
        } = await import('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });const {
          generateKeyPairSync,
        } = require('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });
        34 with the digest algorithm set to MD5, one iteration, and no salt. The lack of salt allows dictionary attacks as the same password always creates the same key. The low iteration count and non-cryptographically secure hash algorithm allow passwords to be tested very rapidly

        In line with OpenSSL's recommendation to use a more modern algorithm instead of

        const {
          generateKeyPairSync,
        } = await import('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });const {
          generateKeyPairSync,
        } = require('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });
        34 it is recommended that developers derive a key and IV on their own using and to use to create the
        let crypto;
        try {
          crypto = await import('node:crypto');
        } catch (err) {
          console.error('crypto support is disabled!');
        }
        16 object

        const {
          generateKeyPairSync,
        } = await import('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });const {
          generateKeyPairSync,
        } = require('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });
        93

        HistoryVersionChangesv17. 9. 0, v16. 17. 0

        The

        const { X509Certificate } = await import('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);const { X509Certificate } = require('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);
        6 option is now optional when using the
        const { X509Certificate } = await import('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);const { X509Certificate } = require('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);
        1 cipher and defaults to 16 bytes

        v11. 6. 0

        The

        const { Certificate } = await import('node:crypto');
        
        const cert1 = new Certificate();
        const cert2 = Certificate();const { Certificate } = require('node:crypto');
        
        const cert1 = new Certificate();
        const cert2 = Certificate();
        63 argument can now be a
        import { createReadStream } from 'node:fs';
        import { stdout } from 'node:process';
        const { createHash } = await import('node:crypto');
        
        const hash = createHash('sha256');
        
        const input = createReadStream('test.js');
        input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
        const { createHash } = require('node:crypto');
        const { stdout } = require('node:process');
        
        const hash = createHash('sha256');
        
        const input = createReadStream('test.js');
        input.pipe(hash).setEncoding('hex').pipe(stdout);
        14

        v11. 2. 0, v10. 17. 0

        The cipher

        const { X509Certificate } = await import('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);const { X509Certificate } = require('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);
        1 (the IETF variant of ChaCha20-Poly1305) is now supported

        v10. 10. 0

        Ciphers in OCB mode are now supported

        v10. 2. 0

        The

        const { X509Certificate } = await import('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);const { X509Certificate } = require('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);
        6 option can now be used to restrict accepted GCM authentication tag lengths

        v9. 9. 0

        The

        const {
          generateKeyPairSync,
        } = await import('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });const {
          generateKeyPairSync,
        } = require('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });
        47 parameter may now be
        const {
          generateKeyPairSync,
        } = await import('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });const {
          generateKeyPairSync,
        } = require('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });
        48 for ciphers which do not need an initialization vector

        v0. 1. 94

        ditambahkan. v0. 1. 94

        Creates and returns a

        let crypto;
        try {
          crypto = await import('node:crypto');
        } catch (err) {
          console.error('crypto support is disabled!');
        }
        16 object that uses the given
        const {
          generateKeyPairSync,
        } = await import('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });const {
          generateKeyPairSync,
        } = require('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });
        16,
        const { Certificate } = await import('node:crypto');
        
        const cert1 = new Certificate();
        const cert2 = Certificate();const { Certificate } = require('node:crypto');
        
        const cert1 = new Certificate();
        const cert2 = Certificate();
        63 and initialization vector (
        const {
          generateKeyPairSync,
        } = await import('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });const {
          generateKeyPairSync,
        } = require('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });
        47)

        The

        let crypto;
        try {
          crypto = await import('node:crypto');
        } catch (err) {
          console.error('crypto support is disabled!');
        }
        44 argument controls stream behavior and is optional except when a cipher in CCM or OCB mode (e. g.
        const {
          generateKeyPairSync,
        } = await import('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });const {
          generateKeyPairSync,
        } = require('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });
        19) is used. In that case, the
        const { X509Certificate } = await import('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);const { X509Certificate } = require('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);
        6 option is required and specifies the length of the authentication tag in bytes, see . In GCM mode, the
        const { X509Certificate } = await import('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);const { X509Certificate } = require('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);
        6 option is not required but can be used to restrict accepted authentication tags to those with the specified length. For
        const { X509Certificate } = await import('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);const { X509Certificate } = require('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);
        1, the
        const { X509Certificate } = await import('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);const { X509Certificate } = require('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);
        6 option defaults to 16 bytes

        The

        const {
          generateKeyPairSync,
        } = await import('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });const {
          generateKeyPairSync,
        } = require('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });
        16 is dependent on OpenSSL, examples are
        const {
          generateKeyPairSync,
        } = await import('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });const {
          generateKeyPairSync,
        } = require('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });
        26, etc. On recent OpenSSL releases,
        const {
          generateKeyPairSync,
        } = await import('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });const {
          generateKeyPairSync,
        } = require('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });
        27 will display the available cipher algorithms

        The

        const { Certificate } = await import('node:crypto');
        
        const cert1 = new Certificate();
        const cert2 = Certificate();const { Certificate } = require('node:crypto');
        
        const cert1 = new Certificate();
        const cert2 = Certificate();
        63 is the raw key used by the
        const {
          generateKeyPairSync,
        } = await import('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });const {
          generateKeyPairSync,
        } = require('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });
        16 and
        const {
          generateKeyPairSync,
        } = await import('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });const {
          generateKeyPairSync,
        } = require('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });
        47 is an initialization vector. Both arguments must be
        const { createDiffieHellmanGroup } = await import('node:crypto');
        const dh = createDiffieHellmanGroup('modp16');const { createDiffieHellmanGroup } = require('node:crypto');
        const dh = createDiffieHellmanGroup('modp16');
        74 encoded strings, Buffers,
        let crypto;
        try {
          crypto = await import('node:crypto');
        } catch (err) {
          console.error('crypto support is disabled!');
        }
        01, or
        let crypto;
        try {
          crypto = await import('node:crypto');
        } catch (err) {
          console.error('crypto support is disabled!');
        }
        02s. The
        const { Certificate } = await import('node:crypto');
        
        const cert1 = new Certificate();
        const cert2 = Certificate();const { Certificate } = require('node:crypto');
        
        const cert1 = new Certificate();
        const cert2 = Certificate();
        63 may optionally be a of type
        const {
          generateKeyPairSync,
        } = await import('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });const {
          generateKeyPairSync,
        } = require('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });
        71. If the cipher does not need an initialization vector,
        const {
          generateKeyPairSync,
        } = await import('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });const {
          generateKeyPairSync,
        } = require('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });
        47 may be
        const {
          generateKeyPairSync,
        } = await import('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });const {
          generateKeyPairSync,
        } = require('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });
        48

        When passing strings for

        const { Certificate } = await import('node:crypto');
        
        const cert1 = new Certificate();
        const cert2 = Certificate();const { Certificate } = require('node:crypto');
        
        const cert1 = new Certificate();
        const cert2 = Certificate();
        63 or
        const {
          generateKeyPairSync,
        } = await import('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });const {
          generateKeyPairSync,
        } = require('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });
        47, please consider

        Vektor inisialisasi harus tidak dapat diprediksi dan unik; . They do not have to be secret. IVs are typically just added to ciphertext messages unencrypted. It may sound contradictory that something has to be unpredictable and unique, but does not have to be secret; remember that an attacker must not be able to predict ahead of time what a given IV will be

        import { Buffer } from 'node:buffer';
        const { randomFillSync } = await import('node:crypto');
        
        const a = new Uint32Array(10);
        console.log(Buffer.from(randomFillSync(a).buffer,
                                a.byteOffset, a.byteLength).toString('hex'));
        
        const b = new DataView(new ArrayBuffer(10));
        console.log(Buffer.from(randomFillSync(b).buffer,
                                b.byteOffset, b.byteLength).toString('hex'));
        
        const c = new ArrayBuffer(10);
        console.log(Buffer.from(randomFillSync(c)).toString('hex'));const { randomFillSync } = require('node:crypto');
        const { Buffer } = require('node:buffer');
        
        const a = new Uint32Array(10);
        console.log(Buffer.from(randomFillSync(a).buffer,
                                a.byteOffset, a.byteLength).toString('hex'));
        
        const b = new DataView(new ArrayBuffer(10));
        console.log(Buffer.from(randomFillSync(b).buffer,
                                b.byteOffset, b.byteLength).toString('hex'));
        
        const c = new ArrayBuffer(10);
        console.log(Buffer.from(randomFillSync(c)).toString('hex'));
        28

        HistoryVersionChangesv8. 0. 0

        The

        import { Buffer } from 'node:buffer';
        const { randomFillSync } = await import('node:crypto');
        
        const a = new Uint32Array(10);
        console.log(Buffer.from(randomFillSync(a).buffer,
                                a.byteOffset, a.byteLength).toString('hex'));
        
        const b = new DataView(new ArrayBuffer(10));
        console.log(Buffer.from(randomFillSync(b).buffer,
                                b.byteOffset, b.byteLength).toString('hex'));
        
        const c = new ArrayBuffer(10);
        console.log(Buffer.from(randomFillSync(c)).toString('hex'));const { randomFillSync } = require('node:crypto');
        const { Buffer } = require('node:buffer');
        
        const a = new Uint32Array(10);
        console.log(Buffer.from(randomFillSync(a).buffer,
                                a.byteOffset, a.byteLength).toString('hex'));
        
        const b = new DataView(new ArrayBuffer(10));
        console.log(Buffer.from(randomFillSync(b).buffer,
                                b.byteOffset, b.byteLength).toString('hex'));
        
        const c = new ArrayBuffer(10);
        console.log(Buffer.from(randomFillSync(c)).toString('hex'));
        29 argument can be any
        let crypto;
        try {
          crypto = await import('node:crypto');
        } catch (err) {
          console.error('crypto support is disabled!');
        }
        01 or
        let crypto;
        try {
          crypto = await import('node:crypto');
        } catch (err) {
          console.error('crypto support is disabled!');
        }
        02 now

        v8. 0. 0

        The

        import { Buffer } from 'node:buffer';
        const { randomFillSync } = await import('node:crypto');
        
        const a = new Uint32Array(10);
        console.log(Buffer.from(randomFillSync(a).buffer,
                                a.byteOffset, a.byteLength).toString('hex'));
        
        const b = new DataView(new ArrayBuffer(10));
        console.log(Buffer.from(randomFillSync(b).buffer,
                                b.byteOffset, b.byteLength).toString('hex'));
        
        const c = new ArrayBuffer(10);
        console.log(Buffer.from(randomFillSync(c)).toString('hex'));const { randomFillSync } = require('node:crypto');
        const { Buffer } = require('node:buffer');
        
        const a = new Uint32Array(10);
        console.log(Buffer.from(randomFillSync(a).buffer,
                                a.byteOffset, a.byteLength).toString('hex'));
        
        const b = new DataView(new ArrayBuffer(10));
        console.log(Buffer.from(randomFillSync(b).buffer,
                                b.byteOffset, b.byteLength).toString('hex'));
        
        const c = new ArrayBuffer(10);
        console.log(Buffer.from(randomFillSync(c)).toString('hex'));
        29 argument can be a
        import { Buffer } from 'node:buffer';
        const { randomFillSync } = await import('node:crypto');
        
        const a = new Uint32Array(10);
        console.log(Buffer.from(randomFillSync(a).buffer,
                                a.byteOffset, a.byteLength).toString('hex'));
        
        const b = new DataView(new ArrayBuffer(10));
        console.log(Buffer.from(randomFillSync(b).buffer,
                                b.byteOffset, b.byteLength).toString('hex'));
        
        const c = new ArrayBuffer(10);
        console.log(Buffer.from(randomFillSync(c)).toString('hex'));const { randomFillSync } = require('node:crypto');
        const { Buffer } = require('node:buffer');
        
        const a = new Uint32Array(10);
        console.log(Buffer.from(randomFillSync(a).buffer,
                                a.byteOffset, a.byteLength).toString('hex'));
        
        const b = new DataView(new ArrayBuffer(10));
        console.log(Buffer.from(randomFillSync(b).buffer,
                                b.byteOffset, b.byteLength).toString('hex'));
        
        const c = new ArrayBuffer(10);
        console.log(Buffer.from(randomFillSync(c)).toString('hex'));
        33 now

        v6. 0. 0

        The default for the encoding parameters changed from

        import { Buffer } from 'node:buffer';
        const { randomFill } = await import('node:crypto');
        
        const a = new Uint32Array(10);
        randomFill(a, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
            .toString('hex'));
        });
        
        const b = new DataView(new ArrayBuffer(10));
        randomFill(b, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
            .toString('hex'));
        });
        
        const c = new ArrayBuffer(10);
        randomFill(c, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf).toString('hex'));
        });const { randomFill } = require('node:crypto');
        const { Buffer } = require('node:buffer');
        
        const a = new Uint32Array(10);
        randomFill(a, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
            .toString('hex'));
        });
        
        const b = new DataView(new ArrayBuffer(10));
        randomFill(b, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
            .toString('hex'));
        });
        
        const c = new ArrayBuffer(10);
        randomFill(c, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf).toString('hex'));
        });
        3 to
        import { Buffer } from 'node:buffer';
        const { randomFill } = await import('node:crypto');
        
        const a = new Uint32Array(10);
        randomFill(a, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
            .toString('hex'));
        });
        
        const b = new DataView(new ArrayBuffer(10));
        randomFill(b, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
            .toString('hex'));
        });
        
        const c = new ArrayBuffer(10);
        randomFill(c, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf).toString('hex'));
        });const { randomFill } = require('node:crypto');
        const { Buffer } = require('node:buffer');
        
        const a = new Uint32Array(10);
        randomFill(a, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
            .toString('hex'));
        });
        
        const b = new DataView(new ArrayBuffer(10));
        randomFill(b, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
            .toString('hex'));
        });
        
        const c = new ArrayBuffer(10);
        randomFill(c, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf).toString('hex'));
        });
        4

        v0. 11. 12

        Added in. v0. 11. 12

        Creates a

        let crypto;
        try {
          crypto = await import('node:crypto');
        } catch (err) {
          console.error('crypto support is disabled!');
        }
        95 key exchange object using the supplied
        import { Buffer } from 'node:buffer';
        const { randomFillSync } = await import('node:crypto');
        
        const a = new Uint32Array(10);
        console.log(Buffer.from(randomFillSync(a).buffer,
                                a.byteOffset, a.byteLength).toString('hex'));
        
        const b = new DataView(new ArrayBuffer(10));
        console.log(Buffer.from(randomFillSync(b).buffer,
                                b.byteOffset, b.byteLength).toString('hex'));
        
        const c = new ArrayBuffer(10);
        console.log(Buffer.from(randomFillSync(c)).toString('hex'));const { randomFillSync } = require('node:crypto');
        const { Buffer } = require('node:buffer');
        
        const a = new Uint32Array(10);
        console.log(Buffer.from(randomFillSync(a).buffer,
                                a.byteOffset, a.byteLength).toString('hex'));
        
        const b = new DataView(new ArrayBuffer(10));
        console.log(Buffer.from(randomFillSync(b).buffer,
                                b.byteOffset, b.byteLength).toString('hex'));
        
        const c = new ArrayBuffer(10);
        console.log(Buffer.from(randomFillSync(c)).toString('hex'));
        29 and an optional specific
        import { Buffer } from 'node:buffer';
        const { randomFillSync } = await import('node:crypto');
        
        const a = new Uint32Array(10);
        console.log(Buffer.from(randomFillSync(a).buffer,
                                a.byteOffset, a.byteLength).toString('hex'));
        
        const b = new DataView(new ArrayBuffer(10));
        console.log(Buffer.from(randomFillSync(b).buffer,
                                b.byteOffset, b.byteLength).toString('hex'));
        
        const c = new ArrayBuffer(10);
        console.log(Buffer.from(randomFillSync(c)).toString('hex'));const { randomFillSync } = require('node:crypto');
        const { Buffer } = require('node:buffer');
        
        const a = new Uint32Array(10);
        console.log(Buffer.from(randomFillSync(a).buffer,
                                a.byteOffset, a.byteLength).toString('hex'));
        
        const b = new DataView(new ArrayBuffer(10));
        console.log(Buffer.from(randomFillSync(b).buffer,
                                b.byteOffset, b.byteLength).toString('hex'));
        
        const c = new ArrayBuffer(10);
        console.log(Buffer.from(randomFillSync(c)).toString('hex'));
        38

        The

        import { Buffer } from 'node:buffer';
        const { randomFillSync } = await import('node:crypto');
        
        const a = new Uint32Array(10);
        console.log(Buffer.from(randomFillSync(a).buffer,
                                a.byteOffset, a.byteLength).toString('hex'));
        
        const b = new DataView(new ArrayBuffer(10));
        console.log(Buffer.from(randomFillSync(b).buffer,
                                b.byteOffset, b.byteLength).toString('hex'));
        
        const c = new ArrayBuffer(10);
        console.log(Buffer.from(randomFillSync(c)).toString('hex'));const { randomFillSync } = require('node:crypto');
        const { Buffer } = require('node:buffer');
        
        const a = new Uint32Array(10);
        console.log(Buffer.from(randomFillSync(a).buffer,
                                a.byteOffset, a.byteLength).toString('hex'));
        
        const b = new DataView(new ArrayBuffer(10));
        console.log(Buffer.from(randomFillSync(b).buffer,
                                b.byteOffset, b.byteLength).toString('hex'));
        
        const c = new ArrayBuffer(10);
        console.log(Buffer.from(randomFillSync(c)).toString('hex'));
        38 argument can be a number, string, or
        import { createReadStream } from 'node:fs';
        import { stdout } from 'node:process';
        const {
          createHmac,
        } = await import('node:crypto');
        
        const hmac = createHmac('sha256', 'a secret');
        
        const input = createReadStream('test.js');
        input.pipe(hmac).pipe(stdout);const {
          createReadStream,
        } = require('node:fs');
        const {
          createHmac,
        } = require('node:crypto');
        const { stdout } = require('node:process');
        
        const hmac = createHmac('sha256', 'a secret');
        
        const input = createReadStream('test.js');
        input.pipe(hmac).pipe(stdout);
        3. If
        import { Buffer } from 'node:buffer';
        const { randomFillSync } = await import('node:crypto');
        
        const a = new Uint32Array(10);
        console.log(Buffer.from(randomFillSync(a).buffer,
                                a.byteOffset, a.byteLength).toString('hex'));
        
        const b = new DataView(new ArrayBuffer(10));
        console.log(Buffer.from(randomFillSync(b).buffer,
                                b.byteOffset, b.byteLength).toString('hex'));
        
        const c = new ArrayBuffer(10);
        console.log(Buffer.from(randomFillSync(c)).toString('hex'));const { randomFillSync } = require('node:crypto');
        const { Buffer } = require('node:buffer');
        
        const a = new Uint32Array(10);
        console.log(Buffer.from(randomFillSync(a).buffer,
                                a.byteOffset, a.byteLength).toString('hex'));
        
        const b = new DataView(new ArrayBuffer(10));
        console.log(Buffer.from(randomFillSync(b).buffer,
                                b.byteOffset, b.byteLength).toString('hex'));
        
        const c = new ArrayBuffer(10);
        console.log(Buffer.from(randomFillSync(c)).toString('hex'));
        38 is not specified, the value
        import { Buffer } from 'node:buffer';
        const { randomFillSync } = await import('node:crypto');
        
        const a = new Uint32Array(10);
        console.log(Buffer.from(randomFillSync(a).buffer,
                                a.byteOffset, a.byteLength).toString('hex'));
        
        const b = new DataView(new ArrayBuffer(10));
        console.log(Buffer.from(randomFillSync(b).buffer,
                                b.byteOffset, b.byteLength).toString('hex'));
        
        const c = new ArrayBuffer(10);
        console.log(Buffer.from(randomFillSync(c)).toString('hex'));const { randomFillSync } = require('node:crypto');
        const { Buffer } = require('node:buffer');
        
        const a = new Uint32Array(10);
        console.log(Buffer.from(randomFillSync(a).buffer,
                                a.byteOffset, a.byteLength).toString('hex'));
        
        const b = new DataView(new ArrayBuffer(10));
        console.log(Buffer.from(randomFillSync(b).buffer,
                                b.byteOffset, b.byteLength).toString('hex'));
        
        const c = new ArrayBuffer(10);
        console.log(Buffer.from(randomFillSync(c)).toString('hex'));
        42 is used

        If

        import { Buffer } from 'node:buffer';
        const { randomFillSync } = await import('node:crypto');
        
        const a = new Uint32Array(10);
        console.log(Buffer.from(randomFillSync(a).buffer,
                                a.byteOffset, a.byteLength).toString('hex'));
        
        const b = new DataView(new ArrayBuffer(10));
        console.log(Buffer.from(randomFillSync(b).buffer,
                                b.byteOffset, b.byteLength).toString('hex'));
        
        const c = new ArrayBuffer(10);
        console.log(Buffer.from(randomFillSync(c)).toString('hex'));const { randomFillSync } = require('node:crypto');
        const { Buffer } = require('node:buffer');
        
        const a = new Uint32Array(10);
        console.log(Buffer.from(randomFillSync(a).buffer,
                                a.byteOffset, a.byteLength).toString('hex'));
        
        const b = new DataView(new ArrayBuffer(10));
        console.log(Buffer.from(randomFillSync(b).buffer,
                                b.byteOffset, b.byteLength).toString('hex'));
        
        const c = new ArrayBuffer(10);
        console.log(Buffer.from(randomFillSync(c)).toString('hex'));
        43 is specified,
        import { Buffer } from 'node:buffer';
        const { randomFillSync } = await import('node:crypto');
        
        const a = new Uint32Array(10);
        console.log(Buffer.from(randomFillSync(a).buffer,
                                a.byteOffset, a.byteLength).toString('hex'));
        
        const b = new DataView(new ArrayBuffer(10));
        console.log(Buffer.from(randomFillSync(b).buffer,
                                b.byteOffset, b.byteLength).toString('hex'));
        
        const c = new ArrayBuffer(10);
        console.log(Buffer.from(randomFillSync(c)).toString('hex'));const { randomFillSync } = require('node:crypto');
        const { Buffer } = require('node:buffer');
        
        const a = new Uint32Array(10);
        console.log(Buffer.from(randomFillSync(a).buffer,
                                a.byteOffset, a.byteLength).toString('hex'));
        
        const b = new DataView(new ArrayBuffer(10));
        console.log(Buffer.from(randomFillSync(b).buffer,
                                b.byteOffset, b.byteLength).toString('hex'));
        
        const c = new ArrayBuffer(10);
        console.log(Buffer.from(randomFillSync(c)).toString('hex'));
        29 is expected to be a string; otherwise a
        import { createReadStream } from 'node:fs';
        import { stdout } from 'node:process';
        const {
          createHmac,
        } = await import('node:crypto');
        
        const hmac = createHmac('sha256', 'a secret');
        
        const input = createReadStream('test.js');
        input.pipe(hmac).pipe(stdout);const {
          createReadStream,
        } = require('node:fs');
        const {
          createHmac,
        } = require('node:crypto');
        const { stdout } = require('node:process');
        
        const hmac = createHmac('sha256', 'a secret');
        
        const input = createReadStream('test.js');
        input.pipe(hmac).pipe(stdout);
        3,
        let crypto;
        try {
          crypto = await import('node:crypto');
        } catch (err) {
          console.error('crypto support is disabled!');
        }
        01, or
        let crypto;
        try {
          crypto = await import('node:crypto');
        } catch (err) {
          console.error('crypto support is disabled!');
        }
        02 is expected

        If

        import { Buffer } from 'node:buffer';
        const { randomFillSync } = await import('node:crypto');
        
        const a = new Uint32Array(10);
        console.log(Buffer.from(randomFillSync(a).buffer,
                                a.byteOffset, a.byteLength).toString('hex'));
        
        const b = new DataView(new ArrayBuffer(10));
        console.log(Buffer.from(randomFillSync(b).buffer,
                                b.byteOffset, b.byteLength).toString('hex'));
        
        const c = new ArrayBuffer(10);
        console.log(Buffer.from(randomFillSync(c)).toString('hex'));const { randomFillSync } = require('node:crypto');
        const { Buffer } = require('node:buffer');
        
        const a = new Uint32Array(10);
        console.log(Buffer.from(randomFillSync(a).buffer,
                                a.byteOffset, a.byteLength).toString('hex'));
        
        const b = new DataView(new ArrayBuffer(10));
        console.log(Buffer.from(randomFillSync(b).buffer,
                                b.byteOffset, b.byteLength).toString('hex'));
        
        const c = new ArrayBuffer(10);
        console.log(Buffer.from(randomFillSync(c)).toString('hex'));
        48 is specified,
        import { Buffer } from 'node:buffer';
        const { randomFillSync } = await import('node:crypto');
        
        const a = new Uint32Array(10);
        console.log(Buffer.from(randomFillSync(a).buffer,
                                a.byteOffset, a.byteLength).toString('hex'));
        
        const b = new DataView(new ArrayBuffer(10));
        console.log(Buffer.from(randomFillSync(b).buffer,
                                b.byteOffset, b.byteLength).toString('hex'));
        
        const c = new ArrayBuffer(10);
        console.log(Buffer.from(randomFillSync(c)).toString('hex'));const { randomFillSync } = require('node:crypto');
        const { Buffer } = require('node:buffer');
        
        const a = new Uint32Array(10);
        console.log(Buffer.from(randomFillSync(a).buffer,
                                a.byteOffset, a.byteLength).toString('hex'));
        
        const b = new DataView(new ArrayBuffer(10));
        console.log(Buffer.from(randomFillSync(b).buffer,
                                b.byteOffset, b.byteLength).toString('hex'));
        
        const c = new ArrayBuffer(10);
        console.log(Buffer.from(randomFillSync(c)).toString('hex'));
        38 is expected to be a string; otherwise a number,
        import { createReadStream } from 'node:fs';
        import { stdout } from 'node:process';
        const {
          createHmac,
        } = await import('node:crypto');
        
        const hmac = createHmac('sha256', 'a secret');
        
        const input = createReadStream('test.js');
        input.pipe(hmac).pipe(stdout);const {
          createReadStream,
        } = require('node:fs');
        const {
          createHmac,
        } = require('node:crypto');
        const { stdout } = require('node:process');
        
        const hmac = createHmac('sha256', 'a secret');
        
        const input = createReadStream('test.js');
        input.pipe(hmac).pipe(stdout);
        3,
        let crypto;
        try {
          crypto = await import('node:crypto');
        } catch (err) {
          console.error('crypto support is disabled!');
        }
        01, or
        let crypto;
        try {
          crypto = await import('node:crypto');
        } catch (err) {
          console.error('crypto support is disabled!');
        }
        02 is expected

        import { Buffer } from 'node:buffer';
        const { randomFillSync } = await import('node:crypto');
        
        const a = new Uint32Array(10);
        console.log(Buffer.from(randomFillSync(a).buffer,
                                a.byteOffset, a.byteLength).toString('hex'));
        
        const b = new DataView(new ArrayBuffer(10));
        console.log(Buffer.from(randomFillSync(b).buffer,
                                b.byteOffset, b.byteLength).toString('hex'));
        
        const c = new ArrayBuffer(10);
        console.log(Buffer.from(randomFillSync(c)).toString('hex'));const { randomFillSync } = require('node:crypto');
        const { Buffer } = require('node:buffer');
        
        const a = new Uint32Array(10);
        console.log(Buffer.from(randomFillSync(a).buffer,
                                a.byteOffset, a.byteLength).toString('hex'));
        
        const b = new DataView(new ArrayBuffer(10));
        console.log(Buffer.from(randomFillSync(b).buffer,
                                b.byteOffset, b.byteLength).toString('hex'));
        
        const c = new ArrayBuffer(10);
        console.log(Buffer.from(randomFillSync(c)).toString('hex'));
        53

        Creates a

        let crypto;
        try {
          crypto = await import('node:crypto');
        } catch (err) {
          console.error('crypto support is disabled!');
        }
        95 key exchange object and generates a prime of
        import { Buffer } from 'node:buffer';
        const { randomFillSync } = await import('node:crypto');
        
        const a = new Uint32Array(10);
        console.log(Buffer.from(randomFillSync(a).buffer,
                                a.byteOffset, a.byteLength).toString('hex'));
        
        const b = new DataView(new ArrayBuffer(10));
        console.log(Buffer.from(randomFillSync(b).buffer,
                                b.byteOffset, b.byteLength).toString('hex'));
        
        const c = new ArrayBuffer(10);
        console.log(Buffer.from(randomFillSync(c)).toString('hex'));const { randomFillSync } = require('node:crypto');
        const { Buffer } = require('node:buffer');
        
        const a = new Uint32Array(10);
        console.log(Buffer.from(randomFillSync(a).buffer,
                                a.byteOffset, a.byteLength).toString('hex'));
        
        const b = new DataView(new ArrayBuffer(10));
        console.log(Buffer.from(randomFillSync(b).buffer,
                                b.byteOffset, b.byteLength).toString('hex'));
        
        const c = new ArrayBuffer(10);
        console.log(Buffer.from(randomFillSync(c)).toString('hex'));
        55 bits using an optional specific numeric
        import { Buffer } from 'node:buffer';
        const { randomFillSync } = await import('node:crypto');
        
        const a = new Uint32Array(10);
        console.log(Buffer.from(randomFillSync(a).buffer,
                                a.byteOffset, a.byteLength).toString('hex'));
        
        const b = new DataView(new ArrayBuffer(10));
        console.log(Buffer.from(randomFillSync(b).buffer,
                                b.byteOffset, b.byteLength).toString('hex'));
        
        const c = new ArrayBuffer(10);
        console.log(Buffer.from(randomFillSync(c)).toString('hex'));const { randomFillSync } = require('node:crypto');
        const { Buffer } = require('node:buffer');
        
        const a = new Uint32Array(10);
        console.log(Buffer.from(randomFillSync(a).buffer,
                                a.byteOffset, a.byteLength).toString('hex'));
        
        const b = new DataView(new ArrayBuffer(10));
        console.log(Buffer.from(randomFillSync(b).buffer,
                                b.byteOffset, b.byteLength).toString('hex'));
        
        const c = new ArrayBuffer(10);
        console.log(Buffer.from(randomFillSync(c)).toString('hex'));
        38. If
        import { Buffer } from 'node:buffer';
        const { randomFillSync } = await import('node:crypto');
        
        const a = new Uint32Array(10);
        console.log(Buffer.from(randomFillSync(a).buffer,
                                a.byteOffset, a.byteLength).toString('hex'));
        
        const b = new DataView(new ArrayBuffer(10));
        console.log(Buffer.from(randomFillSync(b).buffer,
                                b.byteOffset, b.byteLength).toString('hex'));
        
        const c = new ArrayBuffer(10);
        console.log(Buffer.from(randomFillSync(c)).toString('hex'));const { randomFillSync } = require('node:crypto');
        const { Buffer } = require('node:buffer');
        
        const a = new Uint32Array(10);
        console.log(Buffer.from(randomFillSync(a).buffer,
                                a.byteOffset, a.byteLength).toString('hex'));
        
        const b = new DataView(new ArrayBuffer(10));
        console.log(Buffer.from(randomFillSync(b).buffer,
                                b.byteOffset, b.byteLength).toString('hex'));
        
        const c = new ArrayBuffer(10);
        console.log(Buffer.from(randomFillSync(c)).toString('hex'));
        38 is not specified, the value
        import { Buffer } from 'node:buffer';
        const { randomFillSync } = await import('node:crypto');
        
        const a = new Uint32Array(10);
        console.log(Buffer.from(randomFillSync(a).buffer,
                                a.byteOffset, a.byteLength).toString('hex'));
        
        const b = new DataView(new ArrayBuffer(10));
        console.log(Buffer.from(randomFillSync(b).buffer,
                                b.byteOffset, b.byteLength).toString('hex'));
        
        const c = new ArrayBuffer(10);
        console.log(Buffer.from(randomFillSync(c)).toString('hex'));const { randomFillSync } = require('node:crypto');
        const { Buffer } = require('node:buffer');
        
        const a = new Uint32Array(10);
        console.log(Buffer.from(randomFillSync(a).buffer,
                                a.byteOffset, a.byteLength).toString('hex'));
        
        const b = new DataView(new ArrayBuffer(10));
        console.log(Buffer.from(randomFillSync(b).buffer,
                                b.byteOffset, b.byteLength).toString('hex'));
        
        const c = new ArrayBuffer(10);
        console.log(Buffer.from(randomFillSync(c)).toString('hex'));
        42 is used

        import { Buffer } from 'node:buffer';
        const { randomFillSync } = await import('node:crypto');
        
        const a = new Uint32Array(10);
        console.log(Buffer.from(randomFillSync(a).buffer,
                                a.byteOffset, a.byteLength).toString('hex'));
        
        const b = new DataView(new ArrayBuffer(10));
        console.log(Buffer.from(randomFillSync(b).buffer,
                                b.byteOffset, b.byteLength).toString('hex'));
        
        const c = new ArrayBuffer(10);
        console.log(Buffer.from(randomFillSync(c)).toString('hex'));const { randomFillSync } = require('node:crypto');
        const { Buffer } = require('node:buffer');
        
        const a = new Uint32Array(10);
        console.log(Buffer.from(randomFillSync(a).buffer,
                                a.byteOffset, a.byteLength).toString('hex'));
        
        const b = new DataView(new ArrayBuffer(10));
        console.log(Buffer.from(randomFillSync(b).buffer,
                                b.byteOffset, b.byteLength).toString('hex'));
        
        const c = new ArrayBuffer(10);
        console.log(Buffer.from(randomFillSync(c)).toString('hex'));
        59

        An alias for

        import { Buffer } from 'node:buffer';
        const { randomFillSync } = await import('node:crypto');
        
        const a = new Uint32Array(10);
        console.log(Buffer.from(randomFillSync(a).buffer,
                                a.byteOffset, a.byteLength).toString('hex'));
        
        const b = new DataView(new ArrayBuffer(10));
        console.log(Buffer.from(randomFillSync(b).buffer,
                                b.byteOffset, b.byteLength).toString('hex'));
        
        const c = new ArrayBuffer(10);
        console.log(Buffer.from(randomFillSync(c)).toString('hex'));const { randomFillSync } = require('node:crypto');
        const { Buffer } = require('node:buffer');
        
        const a = new Uint32Array(10);
        console.log(Buffer.from(randomFillSync(a).buffer,
                                a.byteOffset, a.byteLength).toString('hex'));
        
        const b = new DataView(new ArrayBuffer(10));
        console.log(Buffer.from(randomFillSync(b).buffer,
                                b.byteOffset, b.byteLength).toString('hex'));
        
        const c = new ArrayBuffer(10);
        console.log(Buffer.from(randomFillSync(c)).toString('hex'));
        61

        Creates an Elliptic Curve Diffie-Hellman (

        const { Certificate } = await import('node:crypto');
        
        const cert1 = new Certificate();
        const cert2 = Certificate();const { Certificate } = require('node:crypto');
        
        const cert1 = new Certificate();
        const cert2 = Certificate();
        58) key exchange object using a predefined curve specified by the
        import { Buffer } from 'node:buffer';
        const { randomFillSync } = await import('node:crypto');
        
        const a = new Uint32Array(10);
        console.log(Buffer.from(randomFillSync(a).buffer,
                                a.byteOffset, a.byteLength).toString('hex'));
        
        const b = new DataView(new ArrayBuffer(10));
        console.log(Buffer.from(randomFillSync(b).buffer,
                                b.byteOffset, b.byteLength).toString('hex'));
        
        const c = new ArrayBuffer(10);
        console.log(Buffer.from(randomFillSync(c)).toString('hex'));const { randomFillSync } = require('node:crypto');
        const { Buffer } = require('node:buffer');
        
        const a = new Uint32Array(10);
        console.log(Buffer.from(randomFillSync(a).buffer,
                                a.byteOffset, a.byteLength).toString('hex'));
        
        const b = new DataView(new ArrayBuffer(10));
        console.log(Buffer.from(randomFillSync(b).buffer,
                                b.byteOffset, b.byteLength).toString('hex'));
        
        const c = new ArrayBuffer(10);
        console.log(Buffer.from(randomFillSync(c)).toString('hex'));
        63 string. Use to obtain a list of available curve names. Pada rilis OpenSSL terbaru,
        const { Certificate } = await import('node:crypto');
        
        const cert1 = new Certificate();
        const cert2 = Certificate();const { Certificate } = require('node:crypto');
        
        const cert1 = new Certificate();
        const cert2 = Certificate();
        73 juga akan menampilkan nama dan deskripsi dari setiap kurva eliptik yang tersedia

        import { Buffer } from 'node:buffer';
        const { randomFillSync } = await import('node:crypto');
        
        const a = new Uint32Array(10);
        console.log(Buffer.from(randomFillSync(a).buffer,
                                a.byteOffset, a.byteLength).toString('hex'));
        
        const b = new DataView(new ArrayBuffer(10));
        console.log(Buffer.from(randomFillSync(b).buffer,
                                b.byteOffset, b.byteLength).toString('hex'));
        
        const c = new ArrayBuffer(10);
        console.log(Buffer.from(randomFillSync(c)).toString('hex'));const { randomFillSync } = require('node:crypto');
        const { Buffer } = require('node:buffer');
        
        const a = new Uint32Array(10);
        console.log(Buffer.from(randomFillSync(a).buffer,
                                a.byteOffset, a.byteLength).toString('hex'));
        
        const b = new DataView(new ArrayBuffer(10));
        console.log(Buffer.from(randomFillSync(b).buffer,
                                b.byteOffset, b.byteLength).toString('hex'));
        
        const c = new ArrayBuffer(10);
        console.log(Buffer.from(randomFillSync(c)).toString('hex'));
        66

        HistoryVersionChangesv12. 8. 0

        The

        const { createDiffieHellmanGroup } = await import('node:crypto');
        const dh = createDiffieHellmanGroup('modp16');const { createDiffieHellmanGroup } = require('node:crypto');
        const dh = createDiffieHellmanGroup('modp16');
        57 option was added for XOF hash functions

        v0. 1. 92

        ditambahkan. v0. 1. 92

        Creates and returns a

        const { createDiffieHellmanGroup } = await import('node:crypto');
        const dh = createDiffieHellmanGroup('modp16');const { createDiffieHellmanGroup } = require('node:crypto');
        const dh = createDiffieHellmanGroup('modp16');
        40 object that can be used to generate hash digests using the given
        const {
          generateKeyPairSync,
        } = await import('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });const {
          generateKeyPairSync,
        } = require('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });
        16. Optional
        let crypto;
        try {
          crypto = await import('node:crypto');
        } catch (err) {
          console.error('crypto support is disabled!');
        }
        44 argument controls stream behavior. For XOF hash functions such as
        const { createDiffieHellmanGroup } = await import('node:crypto');
        const dh = createDiffieHellmanGroup('modp16');const { createDiffieHellmanGroup } = require('node:crypto');
        const dh = createDiffieHellmanGroup('modp16');
        56, the
        const { createDiffieHellmanGroup } = await import('node:crypto');
        const dh = createDiffieHellmanGroup('modp16');const { createDiffieHellmanGroup } = require('node:crypto');
        const dh = createDiffieHellmanGroup('modp16');
        57 option can be used to specify the desired output length in bytes

        The

        const {
          generateKeyPairSync,
        } = await import('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });const {
          generateKeyPairSync,
        } = require('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });
        16 is dependent on the available algorithms supported by the version of OpenSSL on the platform. Contohnya adalah
        import { Buffer } from 'node:buffer';
        const { randomFillSync } = await import('node:crypto');
        
        const a = new Uint32Array(10);
        console.log(Buffer.from(randomFillSync(a).buffer,
                                a.byteOffset, a.byteLength).toString('hex'));
        
        const b = new DataView(new ArrayBuffer(10));
        console.log(Buffer.from(randomFillSync(b).buffer,
                                b.byteOffset, b.byteLength).toString('hex'));
        
        const c = new ArrayBuffer(10);
        console.log(Buffer.from(randomFillSync(c)).toString('hex'));const { randomFillSync } = require('node:crypto');
        const { Buffer } = require('node:buffer');
        
        const a = new Uint32Array(10);
        console.log(Buffer.from(randomFillSync(a).buffer,
                                a.byteOffset, a.byteLength).toString('hex'));
        
        const b = new DataView(new ArrayBuffer(10));
        console.log(Buffer.from(randomFillSync(b).buffer,
                                b.byteOffset, b.byteLength).toString('hex'));
        
        const c = new ArrayBuffer(10);
        console.log(Buffer.from(randomFillSync(c)).toString('hex'));
        _74, ________67______75, dll. On recent releases of OpenSSL,
        import { Buffer } from 'node:buffer';
        const { randomFillSync } = await import('node:crypto');
        
        const a = new Uint32Array(10);
        console.log(Buffer.from(randomFillSync(a).buffer,
                                a.byteOffset, a.byteLength).toString('hex'));
        
        const b = new DataView(new ArrayBuffer(10));
        console.log(Buffer.from(randomFillSync(b).buffer,
                                b.byteOffset, b.byteLength).toString('hex'));
        
        const c = new ArrayBuffer(10);
        console.log(Buffer.from(randomFillSync(c)).toString('hex'));const { randomFillSync } = require('node:crypto');
        const { Buffer } = require('node:buffer');
        
        const a = new Uint32Array(10);
        console.log(Buffer.from(randomFillSync(a).buffer,
                                a.byteOffset, a.byteLength).toString('hex'));
        
        const b = new DataView(new ArrayBuffer(10));
        console.log(Buffer.from(randomFillSync(b).buffer,
                                b.byteOffset, b.byteLength).toString('hex'));
        
        const c = new ArrayBuffer(10);
        console.log(Buffer.from(randomFillSync(c)).toString('hex'));
        76 will display the available digest algorithms

        Example. menghasilkan jumlah sha256 dari sebuah file

        import { Buffer } from 'node:buffer';
        const { randomFillSync } = await import('node:crypto');
        
        const a = new Uint32Array(10);
        console.log(Buffer.from(randomFillSync(a).buffer,
                                a.byteOffset, a.byteLength).toString('hex'));
        
        const b = new DataView(new ArrayBuffer(10));
        console.log(Buffer.from(randomFillSync(b).buffer,
                                b.byteOffset, b.byteLength).toString('hex'));
        
        const c = new ArrayBuffer(10);
        console.log(Buffer.from(randomFillSync(c)).toString('hex'));const { randomFillSync } = require('node:crypto');
        const { Buffer } = require('node:buffer');
        
        const a = new Uint32Array(10);
        console.log(Buffer.from(randomFillSync(a).buffer,
                                a.byteOffset, a.byteLength).toString('hex'));
        
        const b = new DataView(new ArrayBuffer(10));
        console.log(Buffer.from(randomFillSync(b).buffer,
                                b.byteOffset, b.byteLength).toString('hex'));
        
        const c = new ArrayBuffer(10);
        console.log(Buffer.from(randomFillSync(c)).toString('hex'));
        77

        HistoryVersionChangesv15. 0. 0

        Kuncinya juga bisa berupa ArrayBuffer atau CryptoKey. The encoding option was added. The key cannot contain more than 2 ** 32 - 1 bytes

        v11. 6. 0

        The

        const { Certificate } = await import('node:crypto');
        
        const cert1 = new Certificate();
        const cert2 = Certificate();const { Certificate } = require('node:crypto');
        
        const cert1 = new Certificate();
        const cert2 = Certificate();
        63 argument can now be a
        import { createReadStream } from 'node:fs';
        import { stdout } from 'node:process';
        const { createHash } = await import('node:crypto');
        
        const hash = createHash('sha256');
        
        const input = createReadStream('test.js');
        input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
        const { createHash } = require('node:crypto');
        const { stdout } = require('node:process');
        
        const hash = createHash('sha256');
        
        const input = createReadStream('test.js');
        input.pipe(hash).setEncoding('hex').pipe(stdout);
        14

        v0. 1. 94

        ditambahkan. v0. 1. 94

        Creates and returns an

        const { createDiffieHellmanGroup } = await import('node:crypto');
        const dh = createDiffieHellmanGroup('modp16');const { createDiffieHellmanGroup } = require('node:crypto');
        const dh = createDiffieHellmanGroup('modp16');
        80 object that uses the given
        const {
          generateKeyPairSync,
        } = await import('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });const {
          generateKeyPairSync,
        } = require('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });
        16 and
        const { Certificate } = await import('node:crypto');
        
        const cert1 = new Certificate();
        const cert2 = Certificate();const { Certificate } = require('node:crypto');
        
        const cert1 = new Certificate();
        const cert2 = Certificate();
        63. Optional
        let crypto;
        try {
          crypto = await import('node:crypto');
        } catch (err) {
          console.error('crypto support is disabled!');
        }
        44 argument controls stream behavior

        The

        const {
          generateKeyPairSync,
        } = await import('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });const {
          generateKeyPairSync,
        } = require('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });
        16 is dependent on the available algorithms supported by the version of OpenSSL on the platform. Contohnya adalah
        import { Buffer } from 'node:buffer';
        const { randomFillSync } = await import('node:crypto');
        
        const a = new Uint32Array(10);
        console.log(Buffer.from(randomFillSync(a).buffer,
                                a.byteOffset, a.byteLength).toString('hex'));
        
        const b = new DataView(new ArrayBuffer(10));
        console.log(Buffer.from(randomFillSync(b).buffer,
                                b.byteOffset, b.byteLength).toString('hex'));
        
        const c = new ArrayBuffer(10);
        console.log(Buffer.from(randomFillSync(c)).toString('hex'));const { randomFillSync } = require('node:crypto');
        const { Buffer } = require('node:buffer');
        
        const a = new Uint32Array(10);
        console.log(Buffer.from(randomFillSync(a).buffer,
                                a.byteOffset, a.byteLength).toString('hex'));
        
        const b = new DataView(new ArrayBuffer(10));
        console.log(Buffer.from(randomFillSync(b).buffer,
                                b.byteOffset, b.byteLength).toString('hex'));
        
        const c = new ArrayBuffer(10);
        console.log(Buffer.from(randomFillSync(c)).toString('hex'));
        _74, ________67______75, dll. On recent releases of OpenSSL,
        import { Buffer } from 'node:buffer';
        const { randomFillSync } = await import('node:crypto');
        
        const a = new Uint32Array(10);
        console.log(Buffer.from(randomFillSync(a).buffer,
                                a.byteOffset, a.byteLength).toString('hex'));
        
        const b = new DataView(new ArrayBuffer(10));
        console.log(Buffer.from(randomFillSync(b).buffer,
                                b.byteOffset, b.byteLength).toString('hex'));
        
        const c = new ArrayBuffer(10);
        console.log(Buffer.from(randomFillSync(c)).toString('hex'));const { randomFillSync } = require('node:crypto');
        const { Buffer } = require('node:buffer');
        
        const a = new Uint32Array(10);
        console.log(Buffer.from(randomFillSync(a).buffer,
                                a.byteOffset, a.byteLength).toString('hex'));
        
        const b = new DataView(new ArrayBuffer(10));
        console.log(Buffer.from(randomFillSync(b).buffer,
                                b.byteOffset, b.byteLength).toString('hex'));
        
        const c = new ArrayBuffer(10);
        console.log(Buffer.from(randomFillSync(c)).toString('hex'));
        76 will display the available digest algorithms

        The

        const { Certificate } = await import('node:crypto');
        
        const cert1 = new Certificate();
        const cert2 = Certificate();const { Certificate } = require('node:crypto');
        
        const cert1 = new Certificate();
        const cert2 = Certificate();
        63 is the HMAC key used to generate the cryptographic HMAC hash. If it is a , its type must be
        const {
          generateKeyPairSync,
        } = await import('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });const {
          generateKeyPairSync,
        } = require('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });
        71

        Example. generating the sha256 HMAC of a file

        import { Buffer } from 'node:buffer';
        const { randomFillSync } = await import('node:crypto');
        
        const a = new Uint32Array(10);
        console.log(Buffer.from(randomFillSync(a).buffer,
                                a.byteOffset, a.byteLength).toString('hex'));
        
        const b = new DataView(new ArrayBuffer(10));
        console.log(Buffer.from(randomFillSync(b).buffer,
                                b.byteOffset, b.byteLength).toString('hex'));
        
        const c = new ArrayBuffer(10);
        console.log(Buffer.from(randomFillSync(c)).toString('hex'));const { randomFillSync } = require('node:crypto');
        const { Buffer } = require('node:buffer');
        
        const a = new Uint32Array(10);
        console.log(Buffer.from(randomFillSync(a).buffer,
                                a.byteOffset, a.byteLength).toString('hex'));
        
        const b = new DataView(new ArrayBuffer(10));
        console.log(Buffer.from(randomFillSync(b).buffer,
                                b.byteOffset, b.byteLength).toString('hex'));
        
        const c = new ArrayBuffer(10);
        console.log(Buffer.from(randomFillSync(c)).toString('hex'));
        91

        HistoryVersionChangesv15. 12. 0

        The key can also be a JWK object

        v15. 0. 0

        The key can also be an ArrayBuffer. The encoding option was added. Kunci tidak boleh berisi lebih dari 2 ** 32 - 1 byte

        v11. 6. 0

        ditambahkan. v11. 6. 0

        Creates and returns a new key object containing a private key. Jika

        const { Certificate } = await import('node:crypto');
        
        const cert1 = new Certificate();
        const cert2 = Certificate();const { Certificate } = require('node:crypto');
        
        const cert1 = new Certificate();
        const cert2 = Certificate();
        _63 adalah string atau
        import { createReadStream } from 'node:fs';
        import { stdout } from 'node:process';
        const {
          createHmac,
        } = await import('node:crypto');
        
        const hmac = createHmac('sha256', 'a secret');
        
        const input = createReadStream('test.js');
        input.pipe(hmac).pipe(stdout);const {
          createReadStream,
        } = require('node:fs');
        const {
          createHmac,
        } = require('node:crypto');
        const { stdout } = require('node:process');
        
        const hmac = createHmac('sha256', 'a secret');
        
        const input = createReadStream('test.js');
        input.pipe(hmac).pipe(stdout);
        3,
        const { Certificate } = await import('node:crypto');
        
        const cert1 = new Certificate();
        const cert2 = Certificate();const { Certificate } = require('node:crypto');
        
        const cert1 = new Certificate();
        const cert2 = Certificate();
        65 diasumsikan sebagai
        import { createReadStream } from 'node:fs';
        import { stdout } from 'node:process';
        const { createHash } = await import('node:crypto');
        
        const hash = createHash('sha256');
        
        const input = createReadStream('test.js');
        input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
        const { createHash } = require('node:crypto');
        const { stdout } = require('node:process');
        
        const hash = createHash('sha256');
        
        const input = createReadStream('test.js');
        input.pipe(hash).setEncoding('hex').pipe(stdout);
        75;

        If the private key is encrypted, a

        import { createReadStream } from 'node:fs';
        import { stdout } from 'node:process';
        const { createHash } = await import('node:crypto');
        
        const hash = createHash('sha256');
        
        const input = createReadStream('test.js');
        input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
        const { createHash } = require('node:crypto');
        const { stdout } = require('node:process');
        
        const hash = createHash('sha256');
        
        const input = createReadStream('test.js');
        input.pipe(hash).setEncoding('hex').pipe(stdout);
        88 must be specified. The length of the passphrase is limited to 1024 bytes

        import { Buffer } from 'node:buffer';
        const { randomFillSync } = await import('node:crypto');
        
        const a = new Uint32Array(10);
        console.log(Buffer.from(randomFillSync(a).buffer,
                                a.byteOffset, a.byteLength).toString('hex'));
        
        const b = new DataView(new ArrayBuffer(10));
        console.log(Buffer.from(randomFillSync(b).buffer,
                                b.byteOffset, b.byteLength).toString('hex'));
        
        const c = new ArrayBuffer(10);
        console.log(Buffer.from(randomFillSync(c)).toString('hex'));const { randomFillSync } = require('node:crypto');
        const { Buffer } = require('node:buffer');
        
        const a = new Uint32Array(10);
        console.log(Buffer.from(randomFillSync(a).buffer,
                                a.byteOffset, a.byteLength).toString('hex'));
        
        const b = new DataView(new ArrayBuffer(10));
        console.log(Buffer.from(randomFillSync(b).buffer,
                                b.byteOffset, b.byteLength).toString('hex'));
        
        const c = new ArrayBuffer(10);
        console.log(Buffer.from(randomFillSync(c)).toString('hex'));
        _98

        HistoryVersionChangesv15. 12. 0

        The key can also be a JWK object

        v15. 0. 0

        The key can also be an ArrayBuffer. The encoding option was added. Kunci tidak boleh berisi lebih dari 2 ** 32 - 1 byte

        v11. 13. 0

        Argumen

        const { Certificate } = await import('node:crypto');
        
        const cert1 = new Certificate();
        const cert2 = Certificate();const { Certificate } = require('node:crypto');
        
        const cert1 = new Certificate();
        const cert2 = Certificate();
        _63 sekarang bisa menjadi
        import { createReadStream } from 'node:fs';
        import { stdout } from 'node:process';
        const { createHash } = await import('node:crypto');
        
        const hash = createHash('sha256');
        
        const input = createReadStream('test.js');
        input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
        const { createHash } = require('node:crypto');
        const { stdout } = require('node:process');
        
        const hash = createHash('sha256');
        
        const input = createReadStream('test.js');
        input.pipe(hash).setEncoding('hex').pipe(stdout);
        14 dengan tipe
        import { Buffer } from 'node:buffer';
        const { randomFill } = await import('node:crypto');
        
        const a = new Uint32Array(10);
        randomFill(a, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
            .toString('hex'));
        });
        
        const b = new DataView(new ArrayBuffer(10));
        randomFill(b, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
            .toString('hex'));
        });
        
        const c = new ArrayBuffer(10);
        randomFill(c, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf).toString('hex'));
        });const { randomFill } = require('node:crypto');
        const { Buffer } = require('node:buffer');
        
        const a = new Uint32Array(10);
        randomFill(a, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
            .toString('hex'));
        });
        
        const b = new DataView(new ArrayBuffer(10));
        randomFill(b, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
            .toString('hex'));
        });
        
        const c = new ArrayBuffer(10);
        randomFill(c, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf).toString('hex'));
        });
        01

        v11. 7. 0

        Argumen

        const { Certificate } = await import('node:crypto');
        
        const cert1 = new Certificate();
        const cert2 = Certificate();const { Certificate } = require('node:crypto');
        
        const cert1 = new Certificate();
        const cert2 = Certificate();
        _63 sekarang bisa menjadi kunci pribadi

        v11. 6. 0

        ditambahkan. v11. 6. 0

        Membuat dan mengembalikan objek kunci baru yang berisi kunci publik. If

        const { Certificate } = await import('node:crypto');
        
        const cert1 = new Certificate();
        const cert2 = Certificate();const { Certificate } = require('node:crypto');
        
        const cert1 = new Certificate();
        const cert2 = Certificate();
        63 is a string or
        import { createReadStream } from 'node:fs';
        import { stdout } from 'node:process';
        const {
          createHmac,
        } = await import('node:crypto');
        
        const hmac = createHmac('sha256', 'a secret');
        
        const input = createReadStream('test.js');
        input.pipe(hmac).pipe(stdout);const {
          createReadStream,
        } = require('node:fs');
        const {
          createHmac,
        } = require('node:crypto');
        const { stdout } = require('node:process');
        
        const hmac = createHmac('sha256', 'a secret');
        
        const input = createReadStream('test.js');
        input.pipe(hmac).pipe(stdout);
        3,
        const { Certificate } = await import('node:crypto');
        
        const cert1 = new Certificate();
        const cert2 = Certificate();const { Certificate } = require('node:crypto');
        
        const cert1 = new Certificate();
        const cert2 = Certificate();
        65 is assumed to be
        import { createReadStream } from 'node:fs';
        import { stdout } from 'node:process';
        const { createHash } = await import('node:crypto');
        
        const hash = createHash('sha256');
        
        const input = createReadStream('test.js');
        input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
        const { createHash } = require('node:crypto');
        const { stdout } = require('node:process');
        
        const hash = createHash('sha256');
        
        const input = createReadStream('test.js');
        input.pipe(hash).setEncoding('hex').pipe(stdout);
        75; if
        const { Certificate } = await import('node:crypto');
        
        const cert1 = new Certificate();
        const cert2 = Certificate();const { Certificate } = require('node:crypto');
        
        const cert1 = new Certificate();
        const cert2 = Certificate();
        63 is a
        import { createReadStream } from 'node:fs';
        import { stdout } from 'node:process';
        const { createHash } = await import('node:crypto');
        
        const hash = createHash('sha256');
        
        const input = createReadStream('test.js');
        input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
        const { createHash } = require('node:crypto');
        const { stdout } = require('node:process');
        
        const hash = createHash('sha256');
        
        const input = createReadStream('test.js');
        input.pipe(hash).setEncoding('hex').pipe(stdout);
        14 with type
        import { createReadStream } from 'node:fs';
        import { stdout } from 'node:process';
        const {
          createHmac,
        } = await import('node:crypto');
        
        const hmac = createHmac('sha256', 'a secret');
        
        const input = createReadStream('test.js');
        input.pipe(hmac).pipe(stdout);const {
          createReadStream,
        } = require('node:fs');
        const {
          createHmac,
        } = require('node:crypto');
        const { stdout } = require('node:process');
        
        const hmac = createHmac('sha256', 'a secret');
        
        const input = createReadStream('test.js');
        input.pipe(hmac).pipe(stdout);
        07, the public key is derived from the given private key; otherwise,
        const { Certificate } = await import('node:crypto');
        
        const cert1 = new Certificate();
        const cert2 = Certificate();const { Certificate } = require('node:crypto');
        
        const cert1 = new Certificate();
        const cert2 = Certificate();
        63 must be an object with the properties described above

        Jika formatnya adalah

        import { createReadStream } from 'node:fs';
        import { stdout } from 'node:process';
        const { createHash } = await import('node:crypto');
        
        const hash = createHash('sha256');
        
        const input = createReadStream('test.js');
        input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
        const { createHash } = require('node:crypto');
        const { stdout } = require('node:process');
        
        const hash = createHash('sha256');
        
        const input = createReadStream('test.js');
        input.pipe(hash).setEncoding('hex').pipe(stdout);
        _75,
        import { Buffer } from 'node:buffer';
        const { randomFill } = await import('node:crypto');
        
        const a = new Uint32Array(10);
        randomFill(a, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
            .toString('hex'));
        });
        
        const b = new DataView(new ArrayBuffer(10));
        randomFill(b, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
            .toString('hex'));
        });
        
        const c = new ArrayBuffer(10);
        randomFill(c, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf).toString('hex'));
        });const { randomFill } = require('node:crypto');
        const { Buffer } = require('node:buffer');
        
        const a = new Uint32Array(10);
        randomFill(a, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
            .toString('hex'));
        });
        
        const b = new DataView(new ArrayBuffer(10));
        randomFill(b, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
            .toString('hex'));
        });
        
        const c = new ArrayBuffer(10);
        randomFill(c, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf).toString('hex'));
        });
        12 juga dapat berupa X. 509 certificate

        Because public keys can be derived from private keys, a private key may be passed instead of a public key. Dalam hal ini, fungsi ini berperilaku seolah-olah telah dipanggil, kecuali tipe

        import { createReadStream } from 'node:fs';
        import { stdout } from 'node:process';
        const { createHash } = await import('node:crypto');
        
        const hash = createHash('sha256');
        
        const input = createReadStream('test.js');
        input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
        const { createHash } = require('node:crypto');
        const { stdout } = require('node:process');
        
        const hash = createHash('sha256');
        
        const input = createReadStream('test.js');
        input.pipe(hash).setEncoding('hex').pipe(stdout);
        14 yang dikembalikan akan menjadi
        import { createReadStream } from 'node:fs';
        import { stdout } from 'node:process';
        const {
          createHmac,
        } = await import('node:crypto');
        
        const hmac = createHmac('sha256', 'a secret');
        
        const input = createReadStream('test.js');
        input.pipe(hmac).pipe(stdout);const {
          createReadStream,
        } = require('node:fs');
        const {
          createHmac,
        } = require('node:crypto');
        const { stdout } = require('node:process');
        
        const hmac = createHmac('sha256', 'a secret');
        
        const input = createReadStream('test.js');
        input.pipe(hmac).pipe(stdout);
        _06 dan bahwa kunci pribadi tidak dapat diekstrak dari
        import { createReadStream } from 'node:fs';
        import { stdout } from 'node:process';
        const { createHash } = await import('node:crypto');
        
        const hash = createHash('sha256');
        
        const input = createReadStream('test.js');
        input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
        const { createHash } = require('node:crypto');
        const { stdout } = require('node:process');
        
        const hash = createHash('sha256');
        
        const input = createReadStream('test.js');
        input.pipe(hash).setEncoding('hex').pipe(stdout);
        14 yang dikembalikan. Demikian pula, jika
        import { createReadStream } from 'node:fs';
        import { stdout } from 'node:process';
        const { createHash } = await import('node:crypto');
        
        const hash = createHash('sha256');
        
        const input = createReadStream('test.js');
        input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
        const { createHash } = require('node:crypto');
        const { stdout } = require('node:process');
        
        const hash = createHash('sha256');
        
        const input = createReadStream('test.js');
        input.pipe(hash).setEncoding('hex').pipe(stdout);
        14 dengan tipe
        import { createReadStream } from 'node:fs';
        import { stdout } from 'node:process';
        const {
          createHmac,
        } = await import('node:crypto');
        
        const hmac = createHmac('sha256', 'a secret');
        
        const input = createReadStream('test.js');
        input.pipe(hmac).pipe(stdout);const {
          createReadStream,
        } = require('node:fs');
        const {
          createHmac,
        } = require('node:crypto');
        const { stdout } = require('node:process');
        
        const hmac = createHmac('sha256', 'a secret');
        
        const input = createReadStream('test.js');
        input.pipe(hmac).pipe(stdout);
        07 diberikan,
        import { createReadStream } from 'node:fs';
        import { stdout } from 'node:process';
        const { createHash } = await import('node:crypto');
        
        const hash = createHash('sha256');
        
        const input = createReadStream('test.js');
        input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
        const { createHash } = require('node:crypto');
        const { stdout } = require('node:process');
        
        const hash = createHash('sha256');
        
        const input = createReadStream('test.js');
        input.pipe(hash).setEncoding('hex').pipe(stdout);
        _14 baru dengan tipe
        import { createReadStream } from 'node:fs';
        import { stdout } from 'node:process';
        const {
          createHmac,
        } = await import('node:crypto');
        
        const hmac = createHmac('sha256', 'a secret');
        
        const input = createReadStream('test.js');
        input.pipe(hmac).pipe(stdout);const {
          createReadStream,
        } = require('node:fs');
        const {
          createHmac,
        } = require('node:crypto');
        const { stdout } = require('node:process');
        
        const hmac = createHmac('sha256', 'a secret');
        
        const input = createReadStream('test.js');
        input.pipe(hmac).pipe(stdout);
        06 akan dikembalikan dan tidak mungkin untuk mengekstrak kunci pribadi dari objek yang dikembalikan

        import { Buffer } from 'node:buffer';
        const { randomFill } = await import('node:crypto');
        
        const a = new Uint32Array(10);
        randomFill(a, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
            .toString('hex'));
        });
        
        const b = new DataView(new ArrayBuffer(10));
        randomFill(b, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
            .toString('hex'));
        });
        
        const c = new ArrayBuffer(10);
        randomFill(c, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf).toString('hex'));
        });const { randomFill } = require('node:crypto');
        const { Buffer } = require('node:buffer');
        
        const a = new Uint32Array(10);
        randomFill(a, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
            .toString('hex'));
        });
        
        const b = new DataView(new ArrayBuffer(10));
        randomFill(b, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
            .toString('hex'));
        });
        
        const c = new ArrayBuffer(10);
        randomFill(c, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf).toString('hex'));
        });
        21

        HistoryVersionChangesv18. 8. 0, v16. 18. 0

        The key can now be zero-length

        v15. 0. 0

        Kuncinya juga bisa berupa ArrayBuffer atau string. The encoding argument was added. Kunci tidak boleh berisi lebih dari 2 ** 32 - 1 byte

        v11. 6. 0

        ditambahkan. v11. 6. 0

        Membuat dan mengembalikan objek kunci baru yang berisi kunci rahasia untuk enkripsi simetris atau

        const { createDiffieHellmanGroup } = await import('node:crypto');
        const dh = createDiffieHellmanGroup('modp16');const { createDiffieHellmanGroup } = require('node:crypto');
        const dh = createDiffieHellmanGroup('modp16');
        80

        import { Buffer } from 'node:buffer';
        const { randomFill } = await import('node:crypto');
        
        const a = new Uint32Array(10);
        randomFill(a, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
            .toString('hex'));
        });
        
        const b = new DataView(new ArrayBuffer(10));
        randomFill(b, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
            .toString('hex'));
        });
        
        const c = new ArrayBuffer(10);
        randomFill(c, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf).toString('hex'));
        });const { randomFill } = require('node:crypto');
        const { Buffer } = require('node:buffer');
        
        const a = new Uint32Array(10);
        randomFill(a, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
            .toString('hex'));
        });
        
        const b = new DataView(new ArrayBuffer(10));
        randomFill(b, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
            .toString('hex'));
        });
        
        const c = new ArrayBuffer(10);
        randomFill(c, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf).toString('hex'));
        });
        23

        Creates and returns a

        import { createReadStream } from 'node:fs';
        import { stdout } from 'node:process';
        const {
          createHmac,
        } = await import('node:crypto');
        
        const hmac = createHmac('sha256', 'a secret');
        
        const input = createReadStream('test.js');
        input.pipe(hmac).pipe(stdout);const {
          createReadStream,
        } = require('node:fs');
        const {
          createHmac,
        } = require('node:crypto');
        const { stdout } = require('node:process');
        
        const hmac = createHmac('sha256', 'a secret');
        
        const input = createReadStream('test.js');
        input.pipe(hmac).pipe(stdout);
        08 object that uses the given
        const {
          generateKeyPairSync,
        } = await import('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });const {
          generateKeyPairSync,
        } = require('node:crypto');
        
        const {
          publicKey,
          privateKey,
        } = generateKeyPairSync('rsa', {
          modulusLength: 4096,
          publicKeyEncoding: {
            type: 'spki',
            format: 'pem',
          },
          privateKeyEncoding: {
            type: 'pkcs8',
            format: 'pem',
            cipher: 'aes-256-cbc',
            passphrase: 'top secret',
          },
        });
        16. Use to obtain the names of the available digest algorithms. Optional
        let crypto;
        try {
          crypto = await import('node:crypto');
        } catch (err) {
          console.error('crypto support is disabled!');
        }
        44 argument controls the
        import { Buffer } from 'node:buffer';
        const { randomFill } = await import('node:crypto');
        
        const a = new Uint32Array(10);
        randomFill(a, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
            .toString('hex'));
        });
        
        const b = new DataView(new ArrayBuffer(10));
        randomFill(b, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
            .toString('hex'));
        });
        
        const c = new ArrayBuffer(10);
        randomFill(c, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf).toString('hex'));
        });const { randomFill } = require('node:crypto');
        const { Buffer } = require('node:buffer');
        
        const a = new Uint32Array(10);
        randomFill(a, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
            .toString('hex'));
        });
        
        const b = new DataView(new ArrayBuffer(10));
        randomFill(b, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
            .toString('hex'));
        });
        
        const c = new ArrayBuffer(10);
        randomFill(c, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf).toString('hex'));
        });
        28 behavior

        Dalam beberapa kasus, instance

        import { createReadStream } from 'node:fs';
        import { stdout } from 'node:process';
        const {
          createHmac,
        } = await import('node:crypto');
        
        const hmac = createHmac('sha256', 'a secret');
        
        const input = createReadStream('test.js');
        input.pipe(hmac).pipe(stdout);const {
          createReadStream,
        } = require('node:fs');
        const {
          createHmac,
        } = require('node:crypto');
        const { stdout } = require('node:process');
        
        const hmac = createHmac('sha256', 'a secret');
        
        const input = createReadStream('test.js');
        input.pipe(hmac).pipe(stdout);
        08 dapat dibuat menggunakan nama algoritme tanda tangan, seperti
        import { Buffer } from 'node:buffer';
        const { randomFill } = await import('node:crypto');
        
        const a = new Uint32Array(10);
        randomFill(a, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
            .toString('hex'));
        });
        
        const b = new DataView(new ArrayBuffer(10));
        randomFill(b, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
            .toString('hex'));
        });
        
        const c = new ArrayBuffer(10);
        randomFill(c, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf).toString('hex'));
        });const { randomFill } = require('node:crypto');
        const { Buffer } = require('node:buffer');
        
        const a = new Uint32Array(10);
        randomFill(a, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
            .toString('hex'));
        });
        
        const b = new DataView(new ArrayBuffer(10));
        randomFill(b, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
            .toString('hex'));
        });
        
        const c = new ArrayBuffer(10);
        randomFill(c, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf).toString('hex'));
        });
        30, alih-alih algoritme intisari. This will use the corresponding digest algorithm. Ini tidak berfungsi untuk semua algoritme tanda tangan, seperti
        import { Buffer } from 'node:buffer';
        const { randomFill } = await import('node:crypto');
        
        const a = new Uint32Array(10);
        randomFill(a, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
            .toString('hex'));
        });
        
        const b = new DataView(new ArrayBuffer(10));
        randomFill(b, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
            .toString('hex'));
        });
        
        const c = new ArrayBuffer(10);
        randomFill(c, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf).toString('hex'));
        });const { randomFill } = require('node:crypto');
        const { Buffer } = require('node:buffer');
        
        const a = new Uint32Array(10);
        randomFill(a, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
            .toString('hex'));
        });
        
        const b = new DataView(new ArrayBuffer(10));
        randomFill(b, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
            .toString('hex'));
        });
        
        const c = new ArrayBuffer(10);
        randomFill(c, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf).toString('hex'));
        });
        31, jadi sebaiknya selalu gunakan nama algoritme intisari

        import { Buffer } from 'node:buffer';
        const { randomFill } = await import('node:crypto');
        
        const a = new Uint32Array(10);
        randomFill(a, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
            .toString('hex'));
        });
        
        const b = new DataView(new ArrayBuffer(10));
        randomFill(b, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
            .toString('hex'));
        });
        
        const c = new ArrayBuffer(10);
        randomFill(c, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf).toString('hex'));
        });const { randomFill } = require('node:crypto');
        const { Buffer } = require('node:buffer');
        
        const a = new Uint32Array(10);
        randomFill(a, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
            .toString('hex'));
        });
        
        const b = new DataView(new ArrayBuffer(10));
        randomFill(b, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
            .toString('hex'));
        });
        
        const c = new ArrayBuffer(10);
        randomFill(c, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf).toString('hex'));
        });
        _32

        Creates and returns a

        import { createReadStream } from 'node:fs';
        import { stdout } from 'node:process';
        const {
          createHmac,
        } = await import('node:crypto');
        
        const hmac = createHmac('sha256', 'a secret');
        
        const input = createReadStream('test.js');
        input.pipe(hmac).pipe(stdout);const {
          createReadStream,
        } = require('node:fs');
        const {
          createHmac,
        } = require('node:crypto');
        const { stdout } = require('node:process');
        
        const hmac = createHmac('sha256', 'a secret');
        
        const input = createReadStream('test.js');
        input.pipe(hmac).pipe(stdout);
        15 object that uses the given algorithm. Gunakan untuk mendapatkan larik nama dari algoritme penandatanganan yang tersedia. Optional
        let crypto;
        try {
          crypto = await import('node:crypto');
        } catch (err) {
          console.error('crypto support is disabled!');
        }
        44 argument controls the
        import { Buffer } from 'node:buffer';
        const { randomFill } = await import('node:crypto');
        
        const a = new Uint32Array(10);
        randomFill(a, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
            .toString('hex'));
        });
        
        const b = new DataView(new ArrayBuffer(10));
        randomFill(b, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
            .toString('hex'));
        });
        
        const c = new ArrayBuffer(10);
        randomFill(c, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf).toString('hex'));
        });const { randomFill } = require('node:crypto');
        const { Buffer } = require('node:buffer');
        
        const a = new Uint32Array(10);
        randomFill(a, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
            .toString('hex'));
        });
        
        const b = new DataView(new ArrayBuffer(10));
        randomFill(b, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
            .toString('hex'));
        });
        
        const c = new ArrayBuffer(10);
        randomFill(c, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf).toString('hex'));
        });
        28 behavior

        Dalam beberapa kasus, instance

        import { createReadStream } from 'node:fs';
        import { stdout } from 'node:process';
        const {
          createHmac,
        } = await import('node:crypto');
        
        const hmac = createHmac('sha256', 'a secret');
        
        const input = createReadStream('test.js');
        input.pipe(hmac).pipe(stdout);const {
          createReadStream,
        } = require('node:fs');
        const {
          createHmac,
        } = require('node:crypto');
        const { stdout } = require('node:process');
        
        const hmac = createHmac('sha256', 'a secret');
        
        const input = createReadStream('test.js');
        input.pipe(hmac).pipe(stdout);
        15 dapat dibuat menggunakan nama algoritme tanda tangan, seperti
        import { Buffer } from 'node:buffer';
        const { randomFill } = await import('node:crypto');
        
        const a = new Uint32Array(10);
        randomFill(a, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
            .toString('hex'));
        });
        
        const b = new DataView(new ArrayBuffer(10));
        randomFill(b, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
            .toString('hex'));
        });
        
        const c = new ArrayBuffer(10);
        randomFill(c, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf).toString('hex'));
        });const { randomFill } = require('node:crypto');
        const { Buffer } = require('node:buffer');
        
        const a = new Uint32Array(10);
        randomFill(a, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
            .toString('hex'));
        });
        
        const b = new DataView(new ArrayBuffer(10));
        randomFill(b, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
            .toString('hex'));
        });
        
        const c = new ArrayBuffer(10);
        randomFill(c, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf).toString('hex'));
        });
        30, alih-alih algoritme intisari. Ini akan menggunakan algoritma intisari yang sesuai. This does not work for all signature algorithms, such as
        import { Buffer } from 'node:buffer';
        const { randomFill } = await import('node:crypto');
        
        const a = new Uint32Array(10);
        randomFill(a, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
            .toString('hex'));
        });
        
        const b = new DataView(new ArrayBuffer(10));
        randomFill(b, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
            .toString('hex'));
        });
        
        const c = new ArrayBuffer(10);
        randomFill(c, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf).toString('hex'));
        });const { randomFill } = require('node:crypto');
        const { Buffer } = require('node:buffer');
        
        const a = new Uint32Array(10);
        randomFill(a, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
            .toString('hex'));
        });
        
        const b = new DataView(new ArrayBuffer(10));
        randomFill(b, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
            .toString('hex'));
        });
        
        const c = new ArrayBuffer(10);
        randomFill(c, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf).toString('hex'));
        });
        31, so it is best to always use digest algorithm names

        import { Buffer } from 'node:buffer';
        const { randomFill } = await import('node:crypto');
        
        const a = new Uint32Array(10);
        randomFill(a, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
            .toString('hex'));
        });
        
        const b = new DataView(new ArrayBuffer(10));
        randomFill(b, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
            .toString('hex'));
        });
        
        const c = new ArrayBuffer(10);
        randomFill(c, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf).toString('hex'));
        });const { randomFill } = require('node:crypto');
        const { Buffer } = require('node:buffer');
        
        const a = new Uint32Array(10);
        randomFill(a, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
            .toString('hex'));
        });
        
        const b = new DataView(new ArrayBuffer(10));
        randomFill(b, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
            .toString('hex'));
        });
        
        const c = new ArrayBuffer(10);
        randomFill(c, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf).toString('hex'));
        });
        40

        ditambahkan. v13. 9. 0, v12. 17. 0

        Computes the Diffie-Hellman secret based on a

        const { Certificate } = await import('node:crypto');
        
        const cert1 = new Certificate();
        const cert2 = Certificate();const { Certificate } = require('node:crypto');
        
        const cert1 = new Certificate();
        const cert2 = Certificate();
        32 and a
        const { Certificate } = await import('node:crypto');
        
        const cert1 = new Certificate();
        const cert2 = Certificate();const { Certificate } = require('node:crypto');
        
        const cert1 = new Certificate();
        const cert2 = Certificate();
        40. Kedua kunci harus memiliki
        import { Buffer } from 'node:buffer';
        const { randomFill } = await import('node:crypto');
        
        const a = new Uint32Array(10);
        randomFill(a, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
            .toString('hex'));
        });
        
        const b = new DataView(new ArrayBuffer(10));
        randomFill(b, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
            .toString('hex'));
        });
        
        const c = new ArrayBuffer(10);
        randomFill(c, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf).toString('hex'));
        });const { randomFill } = require('node:crypto');
        const { Buffer } = require('node:buffer');
        
        const a = new Uint32Array(10);
        randomFill(a, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
            .toString('hex'));
        });
        
        const b = new DataView(new ArrayBuffer(10));
        randomFill(b, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
            .toString('hex'));
        });
        
        const c = new ArrayBuffer(10);
        randomFill(c, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf).toString('hex'));
        });
        43 yang sama, yang harus salah satu dari
        import { createReadStream } from 'node:fs';
        import { stdout } from 'node:process';
        const { createHash } = await import('node:crypto');
        
        const hash = createHash('sha256');
        
        const input = createReadStream('test.js');
        input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
        const { createHash } = require('node:crypto');
        const { stdout } = require('node:process');
        
        const hash = createHash('sha256');
        
        const input = createReadStream('test.js');
        input.pipe(hash).setEncoding('hex').pipe(stdout);
        48 (untuk Diffie-Hellman),
        import { createReadStream } from 'node:fs';
        import { stdout } from 'node:process';
        const { createHash } = await import('node:crypto');
        
        const hash = createHash('sha256');
        
        const input = createReadStream('test.js');
        input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
        const { createHash } = require('node:crypto');
        const { stdout } = require('node:process');
        
        const hash = createHash('sha256');
        
        const input = createReadStream('test.js');
        input.pipe(hash).setEncoding('hex').pipe(stdout);
        58 (untuk ECDH),
        import { createReadStream } from 'node:fs';
        import { stdout } from 'node:process';
        const { createHash } = await import('node:crypto');
        
        const hash = createHash('sha256');
        
        const input = createReadStream('test.js');
        input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
        const { createHash } = require('node:crypto');
        const { stdout } = require('node:process');
        
        const hash = createHash('sha256');
        
        const input = createReadStream('test.js');
        input.pipe(hash).setEncoding('hex').pipe(stdout);
        52, atau
        import { createReadStream } from 'node:fs';
        import { stdout } from 'node:process';
        const { createHash } = await import('node:crypto');
        
        const hash = createHash('sha256');
        
        const input = createReadStream('test.js');
        input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
        const { createHash } = require('node:crypto');
        const { stdout } = require('node:process');
        
        const hash = createHash('sha256');
        
        const input = createReadStream('test.js');
        input.pipe(hash).setEncoding('hex').pipe(stdout);
        51 (untuk ECDH-ES)

        import { Buffer } from 'node:buffer';
        const { randomFill } = await import('node:crypto');
        
        const a = new Uint32Array(10);
        randomFill(a, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
            .toString('hex'));
        });
        
        const b = new DataView(new ArrayBuffer(10));
        randomFill(b, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
            .toString('hex'));
        });
        
        const c = new ArrayBuffer(10);
        randomFill(c, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf).toString('hex'));
        });const { randomFill } = require('node:crypto');
        const { Buffer } = require('node:buffer');
        
        const a = new Uint32Array(10);
        randomFill(a, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
            .toString('hex'));
        });
        
        const b = new DataView(new ArrayBuffer(10));
        randomFill(b, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
            .toString('hex'));
        });
        
        const c = new ArrayBuffer(10);
        randomFill(c, (err, buf) => {
          if (err) throw err;
          console.log(Buffer.from(buf).toString('hex'));
        });
        _48

        HistoryVersionChangesv18. 0. 0

        Melewati panggilan balik yang tidak valid ke argumen

        const { X509Certificate } = await import('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);const { X509Certificate } = require('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);
        84 sekarang melempar
        const { X509Certificate } = await import('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);const { X509Certificate } = require('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);
        85 alih-alih
        const { X509Certificate } = await import('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);const { X509Certificate } = require('node:crypto');
        
        const x509 = new X509Certificate('{.. pem encoded cert ...}');
        
        console.log(x509.subject);
        86

        v15. 0. 0

        ditambahkan. v15. 0. 0

        • import { createReadStream } from 'node:fs';
          import { stdout } from 'node:process';
          const { createHash } = await import('node:crypto');
          
          const hash = createHash('sha256');
          
          const input = createReadStream('test.js');
          input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
          const { createHash } = require('node:crypto');
          const { stdout } = require('node:process');
          
          const hash = createHash('sha256');
          
          const input = createReadStream('test.js');
          input.pipe(hash).setEncoding('hex').pipe(stdout);
          71. The intended use of the generated secret key. Currently accepted values are
          import { Buffer } from 'node:buffer';
          const { randomFill } = await import('node:crypto');
          
          const a = new Uint32Array(10);
          randomFill(a, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
              .toString('hex'));
          });
          
          const b = new DataView(new ArrayBuffer(10));
          randomFill(b, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
              .toString('hex'));
          });
          
          const c = new ArrayBuffer(10);
          randomFill(c, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf).toString('hex'));
          });const { randomFill } = require('node:crypto');
          const { Buffer } = require('node:buffer');
          
          const a = new Uint32Array(10);
          randomFill(a, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
              .toString('hex'));
          });
          
          const b = new DataView(new ArrayBuffer(10));
          randomFill(b, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
              .toString('hex'));
          });
          
          const c = new ArrayBuffer(10);
          randomFill(c, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf).toString('hex'));
          });
          53 and
          import { Buffer } from 'node:buffer';
          const { randomFill } = await import('node:crypto');
          
          const a = new Uint32Array(10);
          randomFill(a, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
              .toString('hex'));
          });
          
          const b = new DataView(new ArrayBuffer(10));
          randomFill(b, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
              .toString('hex'));
          });
          
          const c = new ArrayBuffer(10);
          randomFill(c, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf).toString('hex'));
          });const { randomFill } = require('node:crypto');
          const { Buffer } = require('node:buffer');
          
          const a = new Uint32Array(10);
          randomFill(a, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
              .toString('hex'));
          });
          
          const b = new DataView(new ArrayBuffer(10));
          randomFill(b, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
              .toString('hex'));
          });
          
          const c = new ArrayBuffer(10);
          randomFill(c, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf).toString('hex'));
          });
          54
        • let crypto;
          try {
            crypto = await import('node:crypto');
          } catch (err) {
            console.error('crypto support is disabled!');
          }
          44.
          • import { Buffer } from 'node:buffer';
            const { randomFill } = await import('node:crypto');
            
            const a = new Uint32Array(10);
            randomFill(a, (err, buf) => {
              if (err) throw err;
              console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                .toString('hex'));
            });
            
            const b = new DataView(new ArrayBuffer(10));
            randomFill(b, (err, buf) => {
              if (err) throw err;
              console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                .toString('hex'));
            });
            
            const c = new ArrayBuffer(10);
            randomFill(c, (err, buf) => {
              if (err) throw err;
              console.log(Buffer.from(buf).toString('hex'));
            });const { randomFill } = require('node:crypto');
            const { Buffer } = require('node:buffer');
            
            const a = new Uint32Array(10);
            randomFill(a, (err, buf) => {
              if (err) throw err;
              console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                .toString('hex'));
            });
            
            const b = new DataView(new ArrayBuffer(10));
            randomFill(b, (err, buf) => {
              if (err) throw err;
              console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                .toString('hex'));
            });
            
            const c = new ArrayBuffer(10);
            randomFill(c, (err, buf) => {
              if (err) throw err;
              console.log(Buffer.from(buf).toString('hex'));
            });
            56. The bit length of the key to generate. This must be a value greater than 0
            • If
              import { createReadStream } from 'node:fs';
              import { stdout } from 'node:process';
              const { createHash } = await import('node:crypto');
              
              const hash = createHash('sha256');
              
              const input = createReadStream('test.js');
              input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
              const { createHash } = require('node:crypto');
              const { stdout } = require('node:process');
              
              const hash = createHash('sha256');
              
              const input = createReadStream('test.js');
              input.pipe(hash).setEncoding('hex').pipe(stdout);
              71 is
              import { Buffer } from 'node:buffer';
              const { randomFill } = await import('node:crypto');
              
              const a = new Uint32Array(10);
              randomFill(a, (err, buf) => {
                if (err) throw err;
                console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                  .toString('hex'));
              });
              
              const b = new DataView(new ArrayBuffer(10));
              randomFill(b, (err, buf) => {
                if (err) throw err;
                console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                  .toString('hex'));
              });
              
              const c = new ArrayBuffer(10);
              randomFill(c, (err, buf) => {
                if (err) throw err;
                console.log(Buffer.from(buf).toString('hex'));
              });const { randomFill } = require('node:crypto');
              const { Buffer } = require('node:buffer');
              
              const a = new Uint32Array(10);
              randomFill(a, (err, buf) => {
                if (err) throw err;
                console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                  .toString('hex'));
              });
              
              const b = new DataView(new ArrayBuffer(10));
              randomFill(b, (err, buf) => {
                if (err) throw err;
                console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                  .toString('hex'));
              });
              
              const c = new ArrayBuffer(10);
              randomFill(c, (err, buf) => {
                if (err) throw err;
                console.log(Buffer.from(buf).toString('hex'));
              });
              53, the minimum is 8, and the maximum length is 231-1. Jika nilainya bukan kelipatan 8, kunci yang dihasilkan akan dipotong menjadi
              import { Buffer } from 'node:buffer';
              const { randomFill } = await import('node:crypto');
              
              const a = new Uint32Array(10);
              randomFill(a, (err, buf) => {
                if (err) throw err;
                console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                  .toString('hex'));
              });
              
              const b = new DataView(new ArrayBuffer(10));
              randomFill(b, (err, buf) => {
                if (err) throw err;
                console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                  .toString('hex'));
              });
              
              const c = new ArrayBuffer(10);
              randomFill(c, (err, buf) => {
                if (err) throw err;
                console.log(Buffer.from(buf).toString('hex'));
              });const { randomFill } = require('node:crypto');
              const { Buffer } = require('node:buffer');
              
              const a = new Uint32Array(10);
              randomFill(a, (err, buf) => {
                if (err) throw err;
                console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                  .toString('hex'));
              });
              
              const b = new DataView(new ArrayBuffer(10));
              randomFill(b, (err, buf) => {
                if (err) throw err;
                console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                  .toString('hex'));
              });
              
              const c = new ArrayBuffer(10);
              randomFill(c, (err, buf) => {
                if (err) throw err;
                console.log(Buffer.from(buf).toString('hex'));
              });
              59
            • If
              import { createReadStream } from 'node:fs';
              import { stdout } from 'node:process';
              const { createHash } = await import('node:crypto');
              
              const hash = createHash('sha256');
              
              const input = createReadStream('test.js');
              input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
              const { createHash } = require('node:crypto');
              const { stdout } = require('node:process');
              
              const hash = createHash('sha256');
              
              const input = createReadStream('test.js');
              input.pipe(hash).setEncoding('hex').pipe(stdout);
              71 is
              import { Buffer } from 'node:buffer';
              const { randomFill } = await import('node:crypto');
              
              const a = new Uint32Array(10);
              randomFill(a, (err, buf) => {
                if (err) throw err;
                console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                  .toString('hex'));
              });
              
              const b = new DataView(new ArrayBuffer(10));
              randomFill(b, (err, buf) => {
                if (err) throw err;
                console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                  .toString('hex'));
              });
              
              const c = new ArrayBuffer(10);
              randomFill(c, (err, buf) => {
                if (err) throw err;
                console.log(Buffer.from(buf).toString('hex'));
              });const { randomFill } = require('node:crypto');
              const { Buffer } = require('node:buffer');
              
              const a = new Uint32Array(10);
              randomFill(a, (err, buf) => {
                if (err) throw err;
                console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                  .toString('hex'));
              });
              
              const b = new DataView(new ArrayBuffer(10));
              randomFill(b, (err, buf) => {
                if (err) throw err;
                console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                  .toString('hex'));
              });
              
              const c = new ArrayBuffer(10);
              randomFill(c, (err, buf) => {
                if (err) throw err;
                console.log(Buffer.from(buf).toString('hex'));
              });
              54, the length must be one of
              import { Buffer } from 'node:buffer';
              const { randomFill } = await import('node:crypto');
              
              const a = new Uint32Array(10);
              randomFill(a, (err, buf) => {
                if (err) throw err;
                console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                  .toString('hex'));
              });
              
              const b = new DataView(new ArrayBuffer(10));
              randomFill(b, (err, buf) => {
                if (err) throw err;
                console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                  .toString('hex'));
              });
              
              const c = new ArrayBuffer(10);
              randomFill(c, (err, buf) => {
                if (err) throw err;
                console.log(Buffer.from(buf).toString('hex'));
              });const { randomFill } = require('node:crypto');
              const { Buffer } = require('node:buffer');
              
              const a = new Uint32Array(10);
              randomFill(a, (err, buf) => {
                if (err) throw err;
                console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                  .toString('hex'));
              });
              
              const b = new DataView(new ArrayBuffer(10));
              randomFill(b, (err, buf) => {
                if (err) throw err;
                console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                  .toString('hex'));
              });
              
              const c = new ArrayBuffer(10);
              randomFill(c, (err, buf) => {
                if (err) throw err;
                console.log(Buffer.from(buf).toString('hex'));
              });
              62,
              import { Buffer } from 'node:buffer';
              const { randomFill } = await import('node:crypto');
              
              const a = new Uint32Array(10);
              randomFill(a, (err, buf) => {
                if (err) throw err;
                console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                  .toString('hex'));
              });
              
              const b = new DataView(new ArrayBuffer(10));
              randomFill(b, (err, buf) => {
                if (err) throw err;
                console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                  .toString('hex'));
              });
              
              const c = new ArrayBuffer(10);
              randomFill(c, (err, buf) => {
                if (err) throw err;
                console.log(Buffer.from(buf).toString('hex'));
              });const { randomFill } = require('node:crypto');
              const { Buffer } = require('node:buffer');
              
              const a = new Uint32Array(10);
              randomFill(a, (err, buf) => {
                if (err) throw err;
                console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                  .toString('hex'));
              });
              
              const b = new DataView(new ArrayBuffer(10));
              randomFill(b, (err, buf) => {
                if (err) throw err;
                console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                  .toString('hex'));
              });
              
              const c = new ArrayBuffer(10);
              randomFill(c, (err, buf) => {
                if (err) throw err;
                console.log(Buffer.from(buf).toString('hex'));
              });
              63, or
              import { Buffer } from 'node:buffer';
              const { randomFill } = await import('node:crypto');
              
              const a = new Uint32Array(10);
              randomFill(a, (err, buf) => {
                if (err) throw err;
                console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                  .toString('hex'));
              });
              
              const b = new DataView(new ArrayBuffer(10));
              randomFill(b, (err, buf) => {
                if (err) throw err;
                console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                  .toString('hex'));
              });
              
              const c = new ArrayBuffer(10);
              randomFill(c, (err, buf) => {
                if (err) throw err;
                console.log(Buffer.from(buf).toString('hex'));
              });const { randomFill } = require('node:crypto');
              const { Buffer } = require('node:buffer');
              
              const a = new Uint32Array(10);
              randomFill(a, (err, buf) => {
                if (err) throw err;
                console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                  .toString('hex'));
              });
              
              const b = new DataView(new ArrayBuffer(10));
              randomFill(b, (err, buf) => {
                if (err) throw err;
                console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                  .toString('hex'));
              });
              
              const c = new ArrayBuffer(10);
              randomFill(c, (err, buf) => {
                if (err) throw err;
                console.log(Buffer.from(buf).toString('hex'));
              });
              64
        • const { X509Certificate } = await import('node:crypto');
          
          const x509 = new X509Certificate('{.. pem encoded cert ...}');
          
          console.log(x509.subject);const { X509Certificate } = require('node:crypto');
          
          const x509 = new X509Certificate('{.. pem encoded cert ...}');
          
          console.log(x509.subject);
          84.
        • Asynchronously generates a new random secret key of the given

          import { Buffer } from 'node:buffer';
          const { randomFill } = await import('node:crypto');
          
          const a = new Uint32Array(10);
          randomFill(a, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
              .toString('hex'));
          });
          
          const b = new DataView(new ArrayBuffer(10));
          randomFill(b, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
              .toString('hex'));
          });
          
          const c = new ArrayBuffer(10);
          randomFill(c, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf).toString('hex'));
          });const { randomFill } = require('node:crypto');
          const { Buffer } = require('node:buffer');
          
          const a = new Uint32Array(10);
          randomFill(a, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
              .toString('hex'));
          });
          
          const b = new DataView(new ArrayBuffer(10));
          randomFill(b, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
              .toString('hex'));
          });
          
          const c = new ArrayBuffer(10);
          randomFill(c, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf).toString('hex'));
          });
          56. The
          import { createReadStream } from 'node:fs';
          import { stdout } from 'node:process';
          const { createHash } = await import('node:crypto');
          
          const hash = createHash('sha256');
          
          const input = createReadStream('test.js');
          input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
          const { createHash } = require('node:crypto');
          const { stdout } = require('node:process');
          
          const hash = createHash('sha256');
          
          const input = createReadStream('test.js');
          input.pipe(hash).setEncoding('hex').pipe(stdout);
          71 will determine which validations will be performed on the
          import { Buffer } from 'node:buffer';
          const { randomFill } = await import('node:crypto');
          
          const a = new Uint32Array(10);
          randomFill(a, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
              .toString('hex'));
          });
          
          const b = new DataView(new ArrayBuffer(10));
          randomFill(b, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
              .toString('hex'));
          });
          
          const c = new ArrayBuffer(10);
          randomFill(c, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf).toString('hex'));
          });const { randomFill } = require('node:crypto');
          const { Buffer } = require('node:buffer');
          
          const a = new Uint32Array(10);
          randomFill(a, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
              .toString('hex'));
          });
          
          const b = new DataView(new ArrayBuffer(10));
          randomFill(b, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
              .toString('hex'));
          });
          
          const c = new ArrayBuffer(10);
          randomFill(c, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf).toString('hex'));
          });
          56

          import { Buffer } from 'node:buffer';
          const { randomFill } = await import('node:crypto');
          
          const a = new Uint32Array(10);
          randomFill(a, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
              .toString('hex'));
          });
          
          const b = new DataView(new ArrayBuffer(10));
          randomFill(b, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
              .toString('hex'));
          });
          
          const c = new ArrayBuffer(10);
          randomFill(c, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf).toString('hex'));
          });const { randomFill } = require('node:crypto');
          const { Buffer } = require('node:buffer');
          
          const a = new Uint32Array(10);
          randomFill(a, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
              .toString('hex'));
          });
          
          const b = new DataView(new ArrayBuffer(10));
          randomFill(b, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
              .toString('hex'));
          });
          
          const c = new ArrayBuffer(10);
          randomFill(c, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf).toString('hex'));
          });
          69

          HistoryVersionChangesv18. 0. 0

          Melewati panggilan balik yang tidak valid ke argumen

          const { X509Certificate } = await import('node:crypto');
          
          const x509 = new X509Certificate('{.. pem encoded cert ...}');
          
          console.log(x509.subject);const { X509Certificate } = require('node:crypto');
          
          const x509 = new X509Certificate('{.. pem encoded cert ...}');
          
          console.log(x509.subject);
          84 sekarang melempar
          const { X509Certificate } = await import('node:crypto');
          
          const x509 = new X509Certificate('{.. pem encoded cert ...}');
          
          console.log(x509.subject);const { X509Certificate } = require('node:crypto');
          
          const x509 = new X509Certificate('{.. pem encoded cert ...}');
          
          console.log(x509.subject);
          85 alih-alih
          const { X509Certificate } = await import('node:crypto');
          
          const x509 = new X509Certificate('{.. pem encoded cert ...}');
          
          console.log(x509.subject);const { X509Certificate } = require('node:crypto');
          
          const x509 = new X509Certificate('{.. pem encoded cert ...}');
          
          console.log(x509.subject);
          86

          v16. 10. 0

          Add ability to define

          import { createReadStream } from 'node:fs';
          import { stdout } from 'node:process';
          const { createHash } = await import('node:crypto');
          
          const hash = createHash('sha256');
          
          const input = createReadStream('test.js');
          input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
          const { createHash } = require('node:crypto');
          const { stdout } = require('node:process');
          
          const hash = createHash('sha256');
          
          const input = createReadStream('test.js');
          input.pipe(hash).setEncoding('hex').pipe(stdout);
          34 sequence parameters for RSA-PSS keys pairs

          v13. 9. 0.v12. 17. 0

          Add support for Diffie-Hellman

          v12. 0. 0

          Add support for RSA-PSS key pairs

          v12. 0. 0

          Add ability to generate X25519 and X448 key pairs

          v12. 0. 0

          Add ability to generate Ed25519 and Ed448 key pairs

          v11. 6. 0

          The

          import { Buffer } from 'node:buffer';
          const { randomFill } = await import('node:crypto');
          
          const a = new Uint32Array(10);
          randomFill(a, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
              .toString('hex'));
          });
          
          const b = new DataView(new ArrayBuffer(10));
          randomFill(b, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
              .toString('hex'));
          });
          
          const c = new ArrayBuffer(10);
          randomFill(c, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf).toString('hex'));
          });const { randomFill } = require('node:crypto');
          const { Buffer } = require('node:buffer');
          
          const a = new Uint32Array(10);
          randomFill(a, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
              .toString('hex'));
          });
          
          const b = new DataView(new ArrayBuffer(10));
          randomFill(b, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
              .toString('hex'));
          });
          
          const c = new ArrayBuffer(10);
          randomFill(c, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf).toString('hex'));
          });
          74 and
          import { Buffer } from 'node:buffer';
          const { randomFill } = await import('node:crypto');
          
          const a = new Uint32Array(10);
          randomFill(a, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
              .toString('hex'));
          });
          
          const b = new DataView(new ArrayBuffer(10));
          randomFill(b, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
              .toString('hex'));
          });
          
          const c = new ArrayBuffer(10);
          randomFill(c, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf).toString('hex'));
          });const { randomFill } = require('node:crypto');
          const { Buffer } = require('node:buffer');
          
          const a = new Uint32Array(10);
          randomFill(a, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
              .toString('hex'));
          });
          
          const b = new DataView(new ArrayBuffer(10));
          randomFill(b, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
              .toString('hex'));
          });
          
          const c = new ArrayBuffer(10);
          randomFill(c, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf).toString('hex'));
          });
          75 functions now produce key objects if no encoding was specified

          v10. 12. 0

          Added in. v10. 12. 0

          Menghasilkan pasangan kunci asimetris baru dari

          import { createReadStream } from 'node:fs';
          import { stdout } from 'node:process';
          const { createHash } = await import('node:crypto');
          
          const hash = createHash('sha256');
          
          const input = createReadStream('test.js');
          input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
          const { createHash } = require('node:crypto');
          const { stdout } = require('node:process');
          
          const hash = createHash('sha256');
          
          const input = createReadStream('test.js');
          input.pipe(hash).setEncoding('hex').pipe(stdout);
          71 yang diberikan. RSA, RSA-PSS, DSA, EC, Ed25519, Ed448, X25519, X448, dan DH saat ini didukung

          If a

          import { Buffer } from 'node:buffer';
          const { randomFill } = await import('node:crypto');
          
          const a = new Uint32Array(10);
          randomFill(a, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
              .toString('hex'));
          });
          
          const b = new DataView(new ArrayBuffer(10));
          randomFill(b, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
              .toString('hex'));
          });
          
          const c = new ArrayBuffer(10);
          randomFill(c, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf).toString('hex'));
          });const { randomFill } = require('node:crypto');
          const { Buffer } = require('node:buffer');
          
          const a = new Uint32Array(10);
          randomFill(a, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
              .toString('hex'));
          });
          
          const b = new DataView(new ArrayBuffer(10));
          randomFill(b, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
              .toString('hex'));
          });
          
          const c = new ArrayBuffer(10);
          randomFill(c, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf).toString('hex'));
          });
          77 or
          import { Buffer } from 'node:buffer';
          const { randomFill } = await import('node:crypto');
          
          const a = new Uint32Array(10);
          randomFill(a, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
              .toString('hex'));
          });
          
          const b = new DataView(new ArrayBuffer(10));
          randomFill(b, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
              .toString('hex'));
          });
          
          const c = new ArrayBuffer(10);
          randomFill(c, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf).toString('hex'));
          });const { randomFill } = require('node:crypto');
          const { Buffer } = require('node:buffer');
          
          const a = new Uint32Array(10);
          randomFill(a, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
              .toString('hex'));
          });
          
          const b = new DataView(new ArrayBuffer(10));
          randomFill(b, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
              .toString('hex'));
          });
          
          const c = new ArrayBuffer(10);
          randomFill(c, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf).toString('hex'));
          });
          78 was specified, this function behaves as if had been called on its result. Otherwise, the respective part of the key is returned as a

          Disarankan untuk menyandikan kunci publik sebagai

          import { createReadStream } from 'node:fs';
          import { stdout } from 'node:process';
          const { createHash } = await import('node:crypto');
          
          const hash = createHash('sha256');
          
          const input = createReadStream('test.js');
          input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
          const { createHash } = require('node:crypto');
          const { stdout } = require('node:process');
          
          const hash = createHash('sha256');
          
          const input = createReadStream('test.js');
          input.pipe(hash).setEncoding('hex').pipe(stdout);
          73 dan kunci pribadi sebagai
          import { createReadStream } from 'node:fs';
          import { stdout } from 'node:process';
          const { createHash } = await import('node:crypto');
          
          const hash = createHash('sha256');
          
          const input = createReadStream('test.js');
          input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
          const { createHash } = require('node:crypto');
          const { stdout } = require('node:process');
          
          const hash = createHash('sha256');
          
          const input = createReadStream('test.js');
          input.pipe(hash).setEncoding('hex').pipe(stdout);
          80 dengan enkripsi untuk penyimpanan jangka panjang

          On completion,

          const { X509Certificate } = await import('node:crypto');
          
          const x509 = new X509Certificate('{.. pem encoded cert ...}');
          
          console.log(x509.subject);const { X509Certificate } = require('node:crypto');
          
          const x509 = new X509Certificate('{.. pem encoded cert ...}');
          
          console.log(x509.subject);
          84 will be called with
          const { X509Certificate } = await import('node:crypto');
          
          const x509 = new X509Certificate('{.. pem encoded cert ...}');
          
          console.log(x509.subject);const { X509Certificate } = require('node:crypto');
          
          const x509 = new X509Certificate('{.. pem encoded cert ...}');
          
          console.log(x509.subject);
          95 set to
          import { createReadStream } from 'node:fs';
          import { stdout } from 'node:process';
          const { createHash } = await import('node:crypto');
          
          const hash = createHash('sha256');
          
          const input = createReadStream('test.js');
          input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
          const { createHash } = require('node:crypto');
          const { stdout } = require('node:process');
          
          const hash = createHash('sha256');
          
          const input = createReadStream('test.js');
          input.pipe(hash).setEncoding('hex').pipe(stdout);
          50 and
          const { Certificate } = await import('node:crypto');
          
          const cert1 = new Certificate();
          const cert2 = Certificate();const { Certificate } = require('node:crypto');
          
          const cert1 = new Certificate();
          const cert2 = Certificate();
          40 /
          const { Certificate } = await import('node:crypto');
          
          const cert1 = new Certificate();
          const cert2 = Certificate();const { Certificate } = require('node:crypto');
          
          const cert1 = new Certificate();
          const cert2 = Certificate();
          32 representing the generated key pair

          If this method is invoked as its ed version, it returns a

          import { Buffer } from 'node:buffer';
          const { randomFill } = await import('node:crypto');
          
          const a = new Uint32Array(10);
          randomFill(a, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
              .toString('hex'));
          });
          
          const b = new DataView(new ArrayBuffer(10));
          randomFill(b, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
              .toString('hex'));
          });
          
          const c = new ArrayBuffer(10);
          randomFill(c, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf).toString('hex'));
          });const { randomFill } = require('node:crypto');
          const { Buffer } = require('node:buffer');
          
          const a = new Uint32Array(10);
          randomFill(a, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
              .toString('hex'));
          });
          
          const b = new DataView(new ArrayBuffer(10));
          randomFill(b, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
              .toString('hex'));
          });
          
          const c = new ArrayBuffer(10);
          randomFill(c, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf).toString('hex'));
          });
          89 for an
          import { Buffer } from 'node:buffer';
          const { randomFill } = await import('node:crypto');
          
          const a = new Uint32Array(10);
          randomFill(a, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
              .toString('hex'));
          });
          
          const b = new DataView(new ArrayBuffer(10));
          randomFill(b, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
              .toString('hex'));
          });
          
          const c = new ArrayBuffer(10);
          randomFill(c, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf).toString('hex'));
          });const { randomFill } = require('node:crypto');
          const { Buffer } = require('node:buffer');
          
          const a = new Uint32Array(10);
          randomFill(a, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
              .toString('hex'));
          });
          
          const b = new DataView(new ArrayBuffer(10));
          randomFill(b, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
              .toString('hex'));
          });
          
          const c = new ArrayBuffer(10);
          randomFill(c, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf).toString('hex'));
          });
          90 with
          const { Certificate } = await import('node:crypto');
          
          const cert1 = new Certificate();
          const cert2 = Certificate();const { Certificate } = require('node:crypto');
          
          const cert1 = new Certificate();
          const cert2 = Certificate();
          40 and
          const { Certificate } = await import('node:crypto');
          
          const cert1 = new Certificate();
          const cert2 = Certificate();const { Certificate } = require('node:crypto');
          
          const cert1 = new Certificate();
          const cert2 = Certificate();
          32 properties

          import { Buffer } from 'node:buffer';
          const { randomFill } = await import('node:crypto');
          
          const a = new Uint32Array(10);
          randomFill(a, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
              .toString('hex'));
          });
          
          const b = new DataView(new ArrayBuffer(10));
          randomFill(b, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
              .toString('hex'));
          });
          
          const c = new ArrayBuffer(10);
          randomFill(c, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf).toString('hex'));
          });const { randomFill } = require('node:crypto');
          const { Buffer } = require('node:buffer');
          
          const a = new Uint32Array(10);
          randomFill(a, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
              .toString('hex'));
          });
          
          const b = new DataView(new ArrayBuffer(10));
          randomFill(b, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
              .toString('hex'));
          });
          
          const c = new ArrayBuffer(10);
          randomFill(c, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf).toString('hex'));
          });
          _93

          HistoryVersionChangesv16. 10. 0

          Add ability to define

          import { createReadStream } from 'node:fs';
          import { stdout } from 'node:process';
          const { createHash } = await import('node:crypto');
          
          const hash = createHash('sha256');
          
          const input = createReadStream('test.js');
          input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
          const { createHash } = require('node:crypto');
          const { stdout } = require('node:process');
          
          const hash = createHash('sha256');
          
          const input = createReadStream('test.js');
          input.pipe(hash).setEncoding('hex').pipe(stdout);
          34 sequence parameters for RSA-PSS keys pairs

          v13. 9. 0.v12. 17. 0

          Add support for Diffie-Hellman

          v12. 0. 0

          Add support for RSA-PSS key pairs

          v12. 0. 0

          Add ability to generate X25519 and X448 key pairs

          v12. 0. 0

          Add ability to generate Ed25519 and Ed448 key pairs

          v11. 6. 0

          The

          import { Buffer } from 'node:buffer';
          const { randomFill } = await import('node:crypto');
          
          const a = new Uint32Array(10);
          randomFill(a, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
              .toString('hex'));
          });
          
          const b = new DataView(new ArrayBuffer(10));
          randomFill(b, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
              .toString('hex'));
          });
          
          const c = new ArrayBuffer(10);
          randomFill(c, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf).toString('hex'));
          });const { randomFill } = require('node:crypto');
          const { Buffer } = require('node:buffer');
          
          const a = new Uint32Array(10);
          randomFill(a, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
              .toString('hex'));
          });
          
          const b = new DataView(new ArrayBuffer(10));
          randomFill(b, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
              .toString('hex'));
          });
          
          const c = new ArrayBuffer(10);
          randomFill(c, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf).toString('hex'));
          });
          74 and
          import { Buffer } from 'node:buffer';
          const { randomFill } = await import('node:crypto');
          
          const a = new Uint32Array(10);
          randomFill(a, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
              .toString('hex'));
          });
          
          const b = new DataView(new ArrayBuffer(10));
          randomFill(b, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
              .toString('hex'));
          });
          
          const c = new ArrayBuffer(10);
          randomFill(c, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf).toString('hex'));
          });const { randomFill } = require('node:crypto');
          const { Buffer } = require('node:buffer');
          
          const a = new Uint32Array(10);
          randomFill(a, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
              .toString('hex'));
          });
          
          const b = new DataView(new ArrayBuffer(10));
          randomFill(b, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
              .toString('hex'));
          });
          
          const c = new ArrayBuffer(10);
          randomFill(c, (err, buf) => {
            if (err) throw err;
            console.log(Buffer.from(buf).toString('hex'));
          });
          75 functions now produce key objects if no encoding was specified

          v10. 12. 0

          Added in. v10. 12. 0

          • import { createReadStream } from 'node:fs';
            import { stdout } from 'node:process';
            const { createHash } = await import('node:crypto');
            
            const hash = createHash('sha256');
            
            const input = createReadStream('test.js');
            input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
            const { createHash } = require('node:crypto');
            const { stdout } = require('node:process');
            
            const hash = createHash('sha256');
            
            const input = createReadStream('test.js');
            input.pipe(hash).setEncoding('hex').pipe(stdout);
            _71. Harus
            import { createReadStream } from 'node:fs';
            import { stdout } from 'node:process';
            const { createHash } = await import('node:crypto');
            
            const hash = createHash('sha256');
            
            const input = createReadStream('test.js');
            input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
            const { createHash } = require('node:crypto');
            const { stdout } = require('node:process');
            
            const hash = createHash('sha256');
            
            const input = createReadStream('test.js');
            input.pipe(hash).setEncoding('hex').pipe(stdout);
            55,
            import { createReadStream } from 'node:fs';
            import { stdout } from 'node:process';
            const { createHash } = await import('node:crypto');
            
            const hash = createHash('sha256');
            
            const input = createReadStream('test.js');
            input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
            const { createHash } = require('node:crypto');
            const { stdout } = require('node:process');
            
            const hash = createHash('sha256');
            
            const input = createReadStream('test.js');
            input.pipe(hash).setEncoding('hex').pipe(stdout);
            49,
            import { createReadStream } from 'node:fs';
            import { stdout } from 'node:process';
            const { createHash } = await import('node:crypto');
            
            const hash = createHash('sha256');
            
            const input = createReadStream('test.js');
            input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
            const { createHash } = require('node:crypto');
            const { stdout } = require('node:process');
            
            const hash = createHash('sha256');
            
            const input = createReadStream('test.js');
            input.pipe(hash).setEncoding('hex').pipe(stdout);
            57,
            import { createReadStream } from 'node:fs';
            import { stdout } from 'node:process';
            const { createHash } = await import('node:crypto');
            
            const hash = createHash('sha256');
            
            const input = createReadStream('test.js');
            input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
            const { createHash } = require('node:crypto');
            const { stdout } = require('node:process');
            
            const hash = createHash('sha256');
            
            const input = createReadStream('test.js');
            input.pipe(hash).setEncoding('hex').pipe(stdout);
            58,
            import { createReadStream } from 'node:fs';
            import { stdout } from 'node:process';
            const { createHash } = await import('node:crypto');
            
            const hash = createHash('sha256');
            
            const input = createReadStream('test.js');
            input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
            const { createHash } = require('node:crypto');
            const { stdout } = require('node:process');
            
            const hash = createHash('sha256');
            
            const input = createReadStream('test.js');
            input.pipe(hash).setEncoding('hex').pipe(stdout);
            53,
            import { createReadStream } from 'node:fs';
            import { stdout } from 'node:process';
            const { createHash } = await import('node:crypto');
            
            const hash = createHash('sha256');
            
            const input = createReadStream('test.js');
            input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
            const { createHash } = require('node:crypto');
            const { stdout } = require('node:process');
            
            const hash = createHash('sha256');
            
            const input = createReadStream('test.js');
            input.pipe(hash).setEncoding('hex').pipe(stdout);
            54,
            import { createReadStream } from 'node:fs';
            import { stdout } from 'node:process';
            const { createHash } = await import('node:crypto');
            
            const hash = createHash('sha256');
            
            const input = createReadStream('test.js');
            input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
            const { createHash } = require('node:crypto');
            const { stdout } = require('node:process');
            
            const hash = createHash('sha256');
            
            const input = createReadStream('test.js');
            input.pipe(hash).setEncoding('hex').pipe(stdout);
            51,
            import { createReadStream } from 'node:fs';
            import { stdout } from 'node:process';
            const { createHash } = await import('node:crypto');
            
            const hash = createHash('sha256');
            
            const input = createReadStream('test.js');
            input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
            const { createHash } = require('node:crypto');
            const { stdout } = require('node:process');
            
            const hash = createHash('sha256');
            
            const input = createReadStream('test.js');
            input.pipe(hash).setEncoding('hex').pipe(stdout);
            52, atau ________36______48
          • let crypto;
            try {
              crypto = await import('node:crypto');
            } catch (err) {
              console.error('crypto support is disabled!');
            }
            44.
          • Returns.

            Menghasilkan pasangan kunci asimetris baru dari

            import { createReadStream } from 'node:fs';
            import { stdout } from 'node:process';
            const { createHash } = await import('node:crypto');
            
            const hash = createHash('sha256');
            
            const input = createReadStream('test.js');
            input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
            const { createHash } = require('node:crypto');
            const { stdout } = require('node:process');
            
            const hash = createHash('sha256');
            
            const input = createReadStream('test.js');
            input.pipe(hash).setEncoding('hex').pipe(stdout);
            71 yang diberikan. RSA, RSA-PSS, DSA, EC, Ed25519, Ed448, X25519, X448, dan DH saat ini didukung

            If a

            import { Buffer } from 'node:buffer';
            const { randomFill } = await import('node:crypto');
            
            const a = new Uint32Array(10);
            randomFill(a, (err, buf) => {
              if (err) throw err;
              console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                .toString('hex'));
            });
            
            const b = new DataView(new ArrayBuffer(10));
            randomFill(b, (err, buf) => {
              if (err) throw err;
              console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                .toString('hex'));
            });
            
            const c = new ArrayBuffer(10);
            randomFill(c, (err, buf) => {
              if (err) throw err;
              console.log(Buffer.from(buf).toString('hex'));
            });const { randomFill } = require('node:crypto');
            const { Buffer } = require('node:buffer');
            
            const a = new Uint32Array(10);
            randomFill(a, (err, buf) => {
              if (err) throw err;
              console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                .toString('hex'));
            });
            
            const b = new DataView(new ArrayBuffer(10));
            randomFill(b, (err, buf) => {
              if (err) throw err;
              console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                .toString('hex'));
            });
            
            const c = new ArrayBuffer(10);
            randomFill(c, (err, buf) => {
              if (err) throw err;
              console.log(Buffer.from(buf).toString('hex'));
            });
            77 or
            import { Buffer } from 'node:buffer';
            const { randomFill } = await import('node:crypto');
            
            const a = new Uint32Array(10);
            randomFill(a, (err, buf) => {
              if (err) throw err;
              console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                .toString('hex'));
            });
            
            const b = new DataView(new ArrayBuffer(10));
            randomFill(b, (err, buf) => {
              if (err) throw err;
              console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                .toString('hex'));
            });
            
            const c = new ArrayBuffer(10);
            randomFill(c, (err, buf) => {
              if (err) throw err;
              console.log(Buffer.from(buf).toString('hex'));
            });const { randomFill } = require('node:crypto');
            const { Buffer } = require('node:buffer');
            
            const a = new Uint32Array(10);
            randomFill(a, (err, buf) => {
              if (err) throw err;
              console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                .toString('hex'));
            });
            
            const b = new DataView(new ArrayBuffer(10));
            randomFill(b, (err, buf) => {
              if (err) throw err;
              console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                .toString('hex'));
            });
            
            const c = new ArrayBuffer(10);
            randomFill(c, (err, buf) => {
              if (err) throw err;
              console.log(Buffer.from(buf).toString('hex'));
            });
            78 was specified, this function behaves as if had been called on its result. Otherwise, the respective part of the key is returned as a

            Saat menyandikan kunci publik, disarankan untuk menggunakan

            import { createReadStream } from 'node:fs';
            import { stdout } from 'node:process';
            const { createHash } = await import('node:crypto');
            
            const hash = createHash('sha256');
            
            const input = createReadStream('test.js');
            input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
            const { createHash } = require('node:crypto');
            const { stdout } = require('node:process');
            
            const hash = createHash('sha256');
            
            const input = createReadStream('test.js');
            input.pipe(hash).setEncoding('hex').pipe(stdout);
            73. When encoding private keys, it is recommended to use
            import { createReadStream } from 'node:fs';
            import { stdout } from 'node:process';
            const { createHash } = await import('node:crypto');
            
            const hash = createHash('sha256');
            
            const input = createReadStream('test.js');
            input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
            const { createHash } = require('node:crypto');
            const { stdout } = require('node:process');
            
            const hash = createHash('sha256');
            
            const input = createReadStream('test.js');
            input.pipe(hash).setEncoding('hex').pipe(stdout);
            80 with a strong passphrase, and to keep the passphrase confidential

            const {
              generateKeyPairSync,
            } = await import('node:crypto');
            
            const {
              publicKey,
              privateKey,
            } = generateKeyPairSync('rsa', {
              modulusLength: 4096,
              publicKeyEncoding: {
                type: 'spki',
                format: 'pem',
              },
              privateKeyEncoding: {
                type: 'pkcs8',
                format: 'pem',
                cipher: 'aes-256-cbc',
                passphrase: 'top secret',
              },
            });const {
              generateKeyPairSync,
            } = require('node:crypto');
            
            const {
              publicKey,
              privateKey,
            } = generateKeyPairSync('rsa', {
              modulusLength: 4096,
              publicKeyEncoding: {
                type: 'spki',
                format: 'pem',
              },
              privateKeyEncoding: {
                type: 'pkcs8',
                format: 'pem',
                cipher: 'aes-256-cbc',
                passphrase: 'top secret',
              },
            });

            The return value

            let crypto;
            try {
              crypto = await import('node:crypto');
            } catch (err) {
              console.error('crypto support is disabled!');
            }
            015 represents the generated key pair. Saat penyandian PEM dipilih, kunci yang bersangkutan akan berupa string, jika tidak maka akan menjadi buffer yang berisi data yang disandikan sebagai DER

            let crypto;
            try {
              crypto = await import('node:crypto');
            } catch (err) {
              console.error('crypto support is disabled!');
            }
            016

            • import { createReadStream } from 'node:fs';
              import { stdout } from 'node:process';
              const { createHash } = await import('node:crypto');
              
              const hash = createHash('sha256');
              
              const input = createReadStream('test.js');
              input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
              const { createHash } = require('node:crypto');
              const { stdout } = require('node:process');
              
              const hash = createHash('sha256');
              
              const input = createReadStream('test.js');
              input.pipe(hash).setEncoding('hex').pipe(stdout);
              71. The intended use of the generated secret key. Currently accepted values are
              import { Buffer } from 'node:buffer';
              const { randomFill } = await import('node:crypto');
              
              const a = new Uint32Array(10);
              randomFill(a, (err, buf) => {
                if (err) throw err;
                console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                  .toString('hex'));
              });
              
              const b = new DataView(new ArrayBuffer(10));
              randomFill(b, (err, buf) => {
                if (err) throw err;
                console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                  .toString('hex'));
              });
              
              const c = new ArrayBuffer(10);
              randomFill(c, (err, buf) => {
                if (err) throw err;
                console.log(Buffer.from(buf).toString('hex'));
              });const { randomFill } = require('node:crypto');
              const { Buffer } = require('node:buffer');
              
              const a = new Uint32Array(10);
              randomFill(a, (err, buf) => {
                if (err) throw err;
                console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                  .toString('hex'));
              });
              
              const b = new DataView(new ArrayBuffer(10));
              randomFill(b, (err, buf) => {
                if (err) throw err;
                console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                  .toString('hex'));
              });
              
              const c = new ArrayBuffer(10);
              randomFill(c, (err, buf) => {
                if (err) throw err;
                console.log(Buffer.from(buf).toString('hex'));
              });
              53 and
              import { Buffer } from 'node:buffer';
              const { randomFill } = await import('node:crypto');
              
              const a = new Uint32Array(10);
              randomFill(a, (err, buf) => {
                if (err) throw err;
                console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                  .toString('hex'));
              });
              
              const b = new DataView(new ArrayBuffer(10));
              randomFill(b, (err, buf) => {
                if (err) throw err;
                console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                  .toString('hex'));
              });
              
              const c = new ArrayBuffer(10);
              randomFill(c, (err, buf) => {
                if (err) throw err;
                console.log(Buffer.from(buf).toString('hex'));
              });const { randomFill } = require('node:crypto');
              const { Buffer } = require('node:buffer');
              
              const a = new Uint32Array(10);
              randomFill(a, (err, buf) => {
                if (err) throw err;
                console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                  .toString('hex'));
              });
              
              const b = new DataView(new ArrayBuffer(10));
              randomFill(b, (err, buf) => {
                if (err) throw err;
                console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                  .toString('hex'));
              });
              
              const c = new ArrayBuffer(10);
              randomFill(c, (err, buf) => {
                if (err) throw err;
                console.log(Buffer.from(buf).toString('hex'));
              });
              54
            • let crypto;
              try {
                crypto = await import('node:crypto');
              } catch (err) {
                console.error('crypto support is disabled!');
              }
              44.
              • import { Buffer } from 'node:buffer';
                const { randomFill } = await import('node:crypto');
                
                const a = new Uint32Array(10);
                randomFill(a, (err, buf) => {
                  if (err) throw err;
                  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                    .toString('hex'));
                });
                
                const b = new DataView(new ArrayBuffer(10));
                randomFill(b, (err, buf) => {
                  if (err) throw err;
                  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                    .toString('hex'));
                });
                
                const c = new ArrayBuffer(10);
                randomFill(c, (err, buf) => {
                  if (err) throw err;
                  console.log(Buffer.from(buf).toString('hex'));
                });const { randomFill } = require('node:crypto');
                const { Buffer } = require('node:buffer');
                
                const a = new Uint32Array(10);
                randomFill(a, (err, buf) => {
                  if (err) throw err;
                  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                    .toString('hex'));
                });
                
                const b = new DataView(new ArrayBuffer(10));
                randomFill(b, (err, buf) => {
                  if (err) throw err;
                  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                    .toString('hex'));
                });
                
                const c = new ArrayBuffer(10);
                randomFill(c, (err, buf) => {
                  if (err) throw err;
                  console.log(Buffer.from(buf).toString('hex'));
                });
                56. The bit length of the key to generate
                • If
                  import { createReadStream } from 'node:fs';
                  import { stdout } from 'node:process';
                  const { createHash } = await import('node:crypto');
                  
                  const hash = createHash('sha256');
                  
                  const input = createReadStream('test.js');
                  input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
                  const { createHash } = require('node:crypto');
                  const { stdout } = require('node:process');
                  
                  const hash = createHash('sha256');
                  
                  const input = createReadStream('test.js');
                  input.pipe(hash).setEncoding('hex').pipe(stdout);
                  71 is
                  import { Buffer } from 'node:buffer';
                  const { randomFill } = await import('node:crypto');
                  
                  const a = new Uint32Array(10);
                  randomFill(a, (err, buf) => {
                    if (err) throw err;
                    console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                      .toString('hex'));
                  });
                  
                  const b = new DataView(new ArrayBuffer(10));
                  randomFill(b, (err, buf) => {
                    if (err) throw err;
                    console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                      .toString('hex'));
                  });
                  
                  const c = new ArrayBuffer(10);
                  randomFill(c, (err, buf) => {
                    if (err) throw err;
                    console.log(Buffer.from(buf).toString('hex'));
                  });const { randomFill } = require('node:crypto');
                  const { Buffer } = require('node:buffer');
                  
                  const a = new Uint32Array(10);
                  randomFill(a, (err, buf) => {
                    if (err) throw err;
                    console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                      .toString('hex'));
                  });
                  
                  const b = new DataView(new ArrayBuffer(10));
                  randomFill(b, (err, buf) => {
                    if (err) throw err;
                    console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                      .toString('hex'));
                  });
                  
                  const c = new ArrayBuffer(10);
                  randomFill(c, (err, buf) => {
                    if (err) throw err;
                    console.log(Buffer.from(buf).toString('hex'));
                  });
                  53, the minimum is 8, and the maximum length is 231-1. Jika nilainya bukan kelipatan 8, kunci yang dihasilkan akan dipotong menjadi
                  import { Buffer } from 'node:buffer';
                  const { randomFill } = await import('node:crypto');
                  
                  const a = new Uint32Array(10);
                  randomFill(a, (err, buf) => {
                    if (err) throw err;
                    console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                      .toString('hex'));
                  });
                  
                  const b = new DataView(new ArrayBuffer(10));
                  randomFill(b, (err, buf) => {
                    if (err) throw err;
                    console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                      .toString('hex'));
                  });
                  
                  const c = new ArrayBuffer(10);
                  randomFill(c, (err, buf) => {
                    if (err) throw err;
                    console.log(Buffer.from(buf).toString('hex'));
                  });const { randomFill } = require('node:crypto');
                  const { Buffer } = require('node:buffer');
                  
                  const a = new Uint32Array(10);
                  randomFill(a, (err, buf) => {
                    if (err) throw err;
                    console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                      .toString('hex'));
                  });
                  
                  const b = new DataView(new ArrayBuffer(10));
                  randomFill(b, (err, buf) => {
                    if (err) throw err;
                    console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                      .toString('hex'));
                  });
                  
                  const c = new ArrayBuffer(10);
                  randomFill(c, (err, buf) => {
                    if (err) throw err;
                    console.log(Buffer.from(buf).toString('hex'));
                  });
                  59
                • If
                  import { createReadStream } from 'node:fs';
                  import { stdout } from 'node:process';
                  const { createHash } = await import('node:crypto');
                  
                  const hash = createHash('sha256');
                  
                  const input = createReadStream('test.js');
                  input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
                  const { createHash } = require('node:crypto');
                  const { stdout } = require('node:process');
                  
                  const hash = createHash('sha256');
                  
                  const input = createReadStream('test.js');
                  input.pipe(hash).setEncoding('hex').pipe(stdout);
                  71 is
                  import { Buffer } from 'node:buffer';
                  const { randomFill } = await import('node:crypto');
                  
                  const a = new Uint32Array(10);
                  randomFill(a, (err, buf) => {
                    if (err) throw err;
                    console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                      .toString('hex'));
                  });
                  
                  const b = new DataView(new ArrayBuffer(10));
                  randomFill(b, (err, buf) => {
                    if (err) throw err;
                    console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                      .toString('hex'));
                  });
                  
                  const c = new ArrayBuffer(10);
                  randomFill(c, (err, buf) => {
                    if (err) throw err;
                    console.log(Buffer.from(buf).toString('hex'));
                  });const { randomFill } = require('node:crypto');
                  const { Buffer } = require('node:buffer');
                  
                  const a = new Uint32Array(10);
                  randomFill(a, (err, buf) => {
                    if (err) throw err;
                    console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                      .toString('hex'));
                  });
                  
                  const b = new DataView(new ArrayBuffer(10));
                  randomFill(b, (err, buf) => {
                    if (err) throw err;
                    console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                      .toString('hex'));
                  });
                  
                  const c = new ArrayBuffer(10);
                  randomFill(c, (err, buf) => {
                    if (err) throw err;
                    console.log(Buffer.from(buf).toString('hex'));
                  });
                  54, the length must be one of
                  import { Buffer } from 'node:buffer';
                  const { randomFill } = await import('node:crypto');
                  
                  const a = new Uint32Array(10);
                  randomFill(a, (err, buf) => {
                    if (err) throw err;
                    console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                      .toString('hex'));
                  });
                  
                  const b = new DataView(new ArrayBuffer(10));
                  randomFill(b, (err, buf) => {
                    if (err) throw err;
                    console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                      .toString('hex'));
                  });
                  
                  const c = new ArrayBuffer(10);
                  randomFill(c, (err, buf) => {
                    if (err) throw err;
                    console.log(Buffer.from(buf).toString('hex'));
                  });const { randomFill } = require('node:crypto');
                  const { Buffer } = require('node:buffer');
                  
                  const a = new Uint32Array(10);
                  randomFill(a, (err, buf) => {
                    if (err) throw err;
                    console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                      .toString('hex'));
                  });
                  
                  const b = new DataView(new ArrayBuffer(10));
                  randomFill(b, (err, buf) => {
                    if (err) throw err;
                    console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                      .toString('hex'));
                  });
                  
                  const c = new ArrayBuffer(10);
                  randomFill(c, (err, buf) => {
                    if (err) throw err;
                    console.log(Buffer.from(buf).toString('hex'));
                  });
                  62,
                  import { Buffer } from 'node:buffer';
                  const { randomFill } = await import('node:crypto');
                  
                  const a = new Uint32Array(10);
                  randomFill(a, (err, buf) => {
                    if (err) throw err;
                    console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                      .toString('hex'));
                  });
                  
                  const b = new DataView(new ArrayBuffer(10));
                  randomFill(b, (err, buf) => {
                    if (err) throw err;
                    console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                      .toString('hex'));
                  });
                  
                  const c = new ArrayBuffer(10);
                  randomFill(c, (err, buf) => {
                    if (err) throw err;
                    console.log(Buffer.from(buf).toString('hex'));
                  });const { randomFill } = require('node:crypto');
                  const { Buffer } = require('node:buffer');
                  
                  const a = new Uint32Array(10);
                  randomFill(a, (err, buf) => {
                    if (err) throw err;
                    console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                      .toString('hex'));
                  });
                  
                  const b = new DataView(new ArrayBuffer(10));
                  randomFill(b, (err, buf) => {
                    if (err) throw err;
                    console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                      .toString('hex'));
                  });
                  
                  const c = new ArrayBuffer(10);
                  randomFill(c, (err, buf) => {
                    if (err) throw err;
                    console.log(Buffer.from(buf).toString('hex'));
                  });
                  63, or
                  import { Buffer } from 'node:buffer';
                  const { randomFill } = await import('node:crypto');
                  
                  const a = new Uint32Array(10);
                  randomFill(a, (err, buf) => {
                    if (err) throw err;
                    console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                      .toString('hex'));
                  });
                  
                  const b = new DataView(new ArrayBuffer(10));
                  randomFill(b, (err, buf) => {
                    if (err) throw err;
                    console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                      .toString('hex'));
                  });
                  
                  const c = new ArrayBuffer(10);
                  randomFill(c, (err, buf) => {
                    if (err) throw err;
                    console.log(Buffer.from(buf).toString('hex'));
                  });const { randomFill } = require('node:crypto');
                  const { Buffer } = require('node:buffer');
                  
                  const a = new Uint32Array(10);
                  randomFill(a, (err, buf) => {
                    if (err) throw err;
                    console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                      .toString('hex'));
                  });
                  
                  const b = new DataView(new ArrayBuffer(10));
                  randomFill(b, (err, buf) => {
                    if (err) throw err;
                    console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                      .toString('hex'));
                  });
                  
                  const c = new ArrayBuffer(10);
                  randomFill(c, (err, buf) => {
                    if (err) throw err;
                    console.log(Buffer.from(buf).toString('hex'));
                  });
                  64
            • Returns.
            • Synchronously generates a new random secret key of the given

              import { Buffer } from 'node:buffer';
              const { randomFill } = await import('node:crypto');
              
              const a = new Uint32Array(10);
              randomFill(a, (err, buf) => {
                if (err) throw err;
                console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                  .toString('hex'));
              });
              
              const b = new DataView(new ArrayBuffer(10));
              randomFill(b, (err, buf) => {
                if (err) throw err;
                console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                  .toString('hex'));
              });
              
              const c = new ArrayBuffer(10);
              randomFill(c, (err, buf) => {
                if (err) throw err;
                console.log(Buffer.from(buf).toString('hex'));
              });const { randomFill } = require('node:crypto');
              const { Buffer } = require('node:buffer');
              
              const a = new Uint32Array(10);
              randomFill(a, (err, buf) => {
                if (err) throw err;
                console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                  .toString('hex'));
              });
              
              const b = new DataView(new ArrayBuffer(10));
              randomFill(b, (err, buf) => {
                if (err) throw err;
                console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                  .toString('hex'));
              });
              
              const c = new ArrayBuffer(10);
              randomFill(c, (err, buf) => {
                if (err) throw err;
                console.log(Buffer.from(buf).toString('hex'));
              });
              56. The
              import { createReadStream } from 'node:fs';
              import { stdout } from 'node:process';
              const { createHash } = await import('node:crypto');
              
              const hash = createHash('sha256');
              
              const input = createReadStream('test.js');
              input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
              const { createHash } = require('node:crypto');
              const { stdout } = require('node:process');
              
              const hash = createHash('sha256');
              
              const input = createReadStream('test.js');
              input.pipe(hash).setEncoding('hex').pipe(stdout);
              71 will determine which validations will be performed on the
              import { Buffer } from 'node:buffer';
              const { randomFill } = await import('node:crypto');
              
              const a = new Uint32Array(10);
              randomFill(a, (err, buf) => {
                if (err) throw err;
                console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                  .toString('hex'));
              });
              
              const b = new DataView(new ArrayBuffer(10));
              randomFill(b, (err, buf) => {
                if (err) throw err;
                console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                  .toString('hex'));
              });
              
              const c = new ArrayBuffer(10);
              randomFill(c, (err, buf) => {
                if (err) throw err;
                console.log(Buffer.from(buf).toString('hex'));
              });const { randomFill } = require('node:crypto');
              const { Buffer } = require('node:buffer');
              
              const a = new Uint32Array(10);
              randomFill(a, (err, buf) => {
                if (err) throw err;
                console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                  .toString('hex'));
              });
              
              const b = new DataView(new ArrayBuffer(10));
              randomFill(b, (err, buf) => {
                if (err) throw err;
                console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                  .toString('hex'));
              });
              
              const c = new ArrayBuffer(10);
              randomFill(c, (err, buf) => {
                if (err) throw err;
                console.log(Buffer.from(buf).toString('hex'));
              });
              56

              let crypto;
              try {
                crypto = await import('node:crypto');
              } catch (err) {
                console.error('crypto support is disabled!');
              }
              033

              HistoryVersionChangesv18. 0. 0

              Melewati panggilan balik yang tidak valid ke argumen

              const { X509Certificate } = await import('node:crypto');
              
              const x509 = new X509Certificate('{.. pem encoded cert ...}');
              
              console.log(x509.subject);const { X509Certificate } = require('node:crypto');
              
              const x509 = new X509Certificate('{.. pem encoded cert ...}');
              
              console.log(x509.subject);
              84 sekarang melempar
              const { X509Certificate } = await import('node:crypto');
              
              const x509 = new X509Certificate('{.. pem encoded cert ...}');
              
              console.log(x509.subject);const { X509Certificate } = require('node:crypto');
              
              const x509 = new X509Certificate('{.. pem encoded cert ...}');
              
              console.log(x509.subject);
              85 alih-alih
              const { X509Certificate } = await import('node:crypto');
              
              const x509 = new X509Certificate('{.. pem encoded cert ...}');
              
              console.log(x509.subject);const { X509Certificate } = require('node:crypto');
              
              const x509 = new X509Certificate('{.. pem encoded cert ...}');
              
              console.log(x509.subject);
              86

              v15. 8. 0

              Added in. v15. 8. 0

              Generates a pseudorandom prime of

              let crypto;
              try {
                crypto = await import('node:crypto');
              } catch (err) {
                console.error('crypto support is disabled!');
              }
              037 bits

              If

              let crypto;
              try {
                crypto = await import('node:crypto');
              } catch (err) {
                console.error('crypto support is disabled!');
              }
              038 is
              import { createReadStream } from 'node:fs';
              import { stdout } from 'node:process';
              const { createHash } = await import('node:crypto');
              
              const hash = createHash('sha256');
              
              const input = createReadStream('test.js');
              input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
              const { createHash } = require('node:crypto');
              const { stdout } = require('node:process');
              
              const hash = createHash('sha256');
              
              const input = createReadStream('test.js');
              input.pipe(hash).setEncoding('hex').pipe(stdout);
              99, the prime will be a safe prime -- that is,
              let crypto;
              try {
                crypto = await import('node:crypto');
              } catch (err) {
                console.error('crypto support is disabled!');
              }
              040 will also be a prime

              Parameter

              let crypto;
              try {
                crypto = await import('node:crypto');
              } catch (err) {
                console.error('crypto support is disabled!');
              }
              041 dan
              let crypto;
              try {
                crypto = await import('node:crypto');
              } catch (err) {
                console.error('crypto support is disabled!');
              }
              042 dapat digunakan untuk menegakkan persyaratan tambahan, dan. g. , for Diffie-Hellman

              • Jika
                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                041 dan
                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                042 keduanya ditetapkan, bilangan prima akan memenuhi syarat bahwa
                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                045
              • Jika hanya
                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                _041 yang ditetapkan dan
                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                038 bukan
                import { createReadStream } from 'node:fs';
                import { stdout } from 'node:process';
                const { createHash } = await import('node:crypto');
                
                const hash = createHash('sha256');
                
                const input = createReadStream('test.js');
                input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
                const { createHash } = require('node:crypto');
                const { stdout } = require('node:process');
                
                const hash = createHash('sha256');
                
                const input = createReadStream('test.js');
                input.pipe(hash).setEncoding('hex').pipe(stdout);
                99, bilangan prima akan memenuhi syarat bahwa
                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                049
              • Jika hanya
                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                _041 yang disetel dan
                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                038 disetel ke
                import { createReadStream } from 'node:fs';
                import { stdout } from 'node:process';
                const { createHash } = await import('node:crypto');
                
                const hash = createHash('sha256');
                
                const input = createReadStream('test.js');
                input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
                const { createHash } = require('node:crypto');
                const { stdout } = require('node:process');
                
                const hash = createHash('sha256');
                
                const input = createReadStream('test.js');
                input.pipe(hash).setEncoding('hex').pipe(stdout);
                99, bilangan prima akan memenuhi syarat bahwa
                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                053. Hal ini diperlukan karena
                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                049 untuk
                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                055 akan bertentangan dengan ketentuan yang diberlakukan oleh
                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                038
              • let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                _042 diabaikan jika
                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                041 tidak diberikan

              Baik

              let crypto;
              try {
                crypto = await import('node:crypto');
              } catch (err) {
                console.error('crypto support is disabled!');
              }
              041 dan
              let crypto;
              try {
                crypto = await import('node:crypto');
              } catch (err) {
                console.error('crypto support is disabled!');
              }
              042 harus dikodekan sebagai urutan big-endian jika diberikan sebagai
              let crypto;
              try {
                crypto = await import('node:crypto');
              } catch (err) {
                console.error('crypto support is disabled!');
              }
              061,
              let crypto;
              try {
                crypto = await import('node:crypto');
              } catch (err) {
                console.error('crypto support is disabled!');
              }
              062,
              let crypto;
              try {
                crypto = await import('node:crypto');
              } catch (err) {
                console.error('crypto support is disabled!');
              }
              01,
              import { createReadStream } from 'node:fs';
              import { stdout } from 'node:process';
              const {
                createHmac,
              } = await import('node:crypto');
              
              const hmac = createHmac('sha256', 'a secret');
              
              const input = createReadStream('test.js');
              input.pipe(hmac).pipe(stdout);const {
                createReadStream,
              } = require('node:fs');
              const {
                createHmac,
              } = require('node:crypto');
              const { stdout } = require('node:process');
              
              const hmac = createHmac('sha256', 'a secret');
              
              const input = createReadStream('test.js');
              input.pipe(hmac).pipe(stdout);
              3, atau
              let crypto;
              try {
                crypto = await import('node:crypto');
              } catch (err) {
                console.error('crypto support is disabled!');
              }
              02

              Secara default, bilangan prima dikodekan sebagai urutan oktet big-endian dalam sebuah. Jika opsi

              let crypto;
              try {
                crypto = await import('node:crypto');
              } catch (err) {
                console.error('crypto support is disabled!');
              }
              _066 adalah
              import { createReadStream } from 'node:fs';
              import { stdout } from 'node:process';
              const { createHash } = await import('node:crypto');
              
              const hash = createHash('sha256');
              
              const input = createReadStream('test.js');
              input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
              const { createHash } = require('node:crypto');
              const { stdout } = require('node:process');
              
              const hash = createHash('sha256');
              
              const input = createReadStream('test.js');
              input.pipe(hash).setEncoding('hex').pipe(stdout);
              99, maka disediakan

              let crypto;
              try {
                crypto = await import('node:crypto');
              } catch (err) {
                console.error('crypto support is disabled!');
              }
              _068

              Generates a pseudorandom prime of

              let crypto;
              try {
                crypto = await import('node:crypto');
              } catch (err) {
                console.error('crypto support is disabled!');
              }
              037 bits

              If

              let crypto;
              try {
                crypto = await import('node:crypto');
              } catch (err) {
                console.error('crypto support is disabled!');
              }
              038 is
              import { createReadStream } from 'node:fs';
              import { stdout } from 'node:process';
              const { createHash } = await import('node:crypto');
              
              const hash = createHash('sha256');
              
              const input = createReadStream('test.js');
              input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
              const { createHash } = require('node:crypto');
              const { stdout } = require('node:process');
              
              const hash = createHash('sha256');
              
              const input = createReadStream('test.js');
              input.pipe(hash).setEncoding('hex').pipe(stdout);
              99, the prime will be a safe prime -- that is,
              let crypto;
              try {
                crypto = await import('node:crypto');
              } catch (err) {
                console.error('crypto support is disabled!');
              }
              040 will also be a prime

              Parameter

              let crypto;
              try {
                crypto = await import('node:crypto');
              } catch (err) {
                console.error('crypto support is disabled!');
              }
              041 dan
              let crypto;
              try {
                crypto = await import('node:crypto');
              } catch (err) {
                console.error('crypto support is disabled!');
              }
              042 dapat digunakan untuk menegakkan persyaratan tambahan, dan. g. , for Diffie-Hellman

              • Jika
                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                041 dan
                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                042 keduanya ditetapkan, bilangan prima akan memenuhi syarat bahwa
                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                045
              • Jika hanya
                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                _041 yang ditetapkan dan
                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                038 bukan
                import { createReadStream } from 'node:fs';
                import { stdout } from 'node:process';
                const { createHash } = await import('node:crypto');
                
                const hash = createHash('sha256');
                
                const input = createReadStream('test.js');
                input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
                const { createHash } = require('node:crypto');
                const { stdout } = require('node:process');
                
                const hash = createHash('sha256');
                
                const input = createReadStream('test.js');
                input.pipe(hash).setEncoding('hex').pipe(stdout);
                99, bilangan prima akan memenuhi syarat bahwa
                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                049
              • Jika hanya
                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                _041 yang disetel dan
                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                038 disetel ke
                import { createReadStream } from 'node:fs';
                import { stdout } from 'node:process';
                const { createHash } = await import('node:crypto');
                
                const hash = createHash('sha256');
                
                const input = createReadStream('test.js');
                input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
                const { createHash } = require('node:crypto');
                const { stdout } = require('node:process');
                
                const hash = createHash('sha256');
                
                const input = createReadStream('test.js');
                input.pipe(hash).setEncoding('hex').pipe(stdout);
                99, bilangan prima akan memenuhi syarat bahwa
                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                053. Hal ini diperlukan karena
                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                049 untuk
                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                055 akan bertentangan dengan ketentuan yang diberlakukan oleh
                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                038
              • let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                _042 diabaikan jika
                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                041 tidak diberikan

              Baik

              let crypto;
              try {
                crypto = await import('node:crypto');
              } catch (err) {
                console.error('crypto support is disabled!');
              }
              041 dan
              let crypto;
              try {
                crypto = await import('node:crypto');
              } catch (err) {
                console.error('crypto support is disabled!');
              }
              042 harus dikodekan sebagai urutan big-endian jika diberikan sebagai
              let crypto;
              try {
                crypto = await import('node:crypto');
              } catch (err) {
                console.error('crypto support is disabled!');
              }
              061,
              let crypto;
              try {
                crypto = await import('node:crypto');
              } catch (err) {
                console.error('crypto support is disabled!');
              }
              062,
              let crypto;
              try {
                crypto = await import('node:crypto');
              } catch (err) {
                console.error('crypto support is disabled!');
              }
              01,
              import { createReadStream } from 'node:fs';
              import { stdout } from 'node:process';
              const {
                createHmac,
              } = await import('node:crypto');
              
              const hmac = createHmac('sha256', 'a secret');
              
              const input = createReadStream('test.js');
              input.pipe(hmac).pipe(stdout);const {
                createReadStream,
              } = require('node:fs');
              const {
                createHmac,
              } = require('node:crypto');
              const { stdout } = require('node:process');
              
              const hmac = createHmac('sha256', 'a secret');
              
              const input = createReadStream('test.js');
              input.pipe(hmac).pipe(stdout);
              3, atau
              let crypto;
              try {
                crypto = await import('node:crypto');
              } catch (err) {
                console.error('crypto support is disabled!');
              }
              02

              Secara default, bilangan prima dikodekan sebagai urutan oktet big-endian dalam sebuah. Jika opsi

              let crypto;
              try {
                crypto = await import('node:crypto');
              } catch (err) {
                console.error('crypto support is disabled!');
              }
              _066 adalah
              import { createReadStream } from 'node:fs';
              import { stdout } from 'node:process';
              const { createHash } = await import('node:crypto');
              
              const hash = createHash('sha256');
              
              const input = createReadStream('test.js');
              input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
              const { createHash } = require('node:crypto');
              const { stdout } = require('node:process');
              
              const hash = createHash('sha256');
              
              const input = createReadStream('test.js');
              input.pipe(hash).setEncoding('hex').pipe(stdout);
              99, maka disediakan

              let crypto;
              try {
                crypto = await import('node:crypto');
              } catch (err) {
                console.error('crypto support is disabled!');
              }
              _100

              • let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                _101. . Nama atau nid sandi yang akan dikueri
              • let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                44.
              • Returns.
                • const { X509Certificate } = await import('node:crypto');
                  
                  const x509 = new X509Certificate('{.. pem encoded cert ...}');
                  
                  console.log(x509.subject);const { X509Certificate } = require('node:crypto');
                  
                  const x509 = new X509Certificate('{.. pem encoded cert ...}');
                  
                  console.log(x509.subject);
                  33 Nama sandi
                • let crypto;
                  try {
                    crypto = await import('node:crypto');
                  } catch (err) {
                    console.error('crypto support is disabled!');
                  }
                  104 The nid of the cipher
                • let crypto;
                  try {
                    crypto = await import('node:crypto');
                  } catch (err) {
                    console.error('crypto support is disabled!');
                  }
                  105 The block size of the cipher in bytes. Properti ini dihilangkan ketika
                  let crypto;
                  try {
                    crypto = await import('node:crypto');
                  } catch (err) {
                    console.error('crypto support is disabled!');
                  }
                  _106 adalah
                  let crypto;
                  try {
                    crypto = await import('node:crypto');
                  } catch (err) {
                    console.error('crypto support is disabled!');
                  }
                  107
                • let crypto;
                  try {
                    crypto = await import('node:crypto');
                  } catch (err) {
                    console.error('crypto support is disabled!');
                  }
                  _108 Panjang vektor inisialisasi yang diharapkan atau default dalam byte. Properti ini dihilangkan jika cipher tidak menggunakan vektor inisialisasi
                • let crypto;
                  try {
                    crypto = await import('node:crypto');
                  } catch (err) {
                    console.error('crypto support is disabled!');
                  }
                  109 The expected or default key length in bytes
                • let crypto;
                  try {
                    crypto = await import('node:crypto');
                  } catch (err) {
                    console.error('crypto support is disabled!');
                  }
                  106 The cipher mode. Salah satu dari
                  let crypto;
                  try {
                    crypto = await import('node:crypto');
                  } catch (err) {
                    console.error('crypto support is disabled!');
                  }
                  111,
                  let crypto;
                  try {
                    crypto = await import('node:crypto');
                  } catch (err) {
                    console.error('crypto support is disabled!');
                  }
                  112,
                  let crypto;
                  try {
                    crypto = await import('node:crypto');
                  } catch (err) {
                    console.error('crypto support is disabled!');
                  }
                  113,
                  let crypto;
                  try {
                    crypto = await import('node:crypto');
                  } catch (err) {
                    console.error('crypto support is disabled!');
                  }
                  114,
                  let crypto;
                  try {
                    crypto = await import('node:crypto');
                  } catch (err) {
                    console.error('crypto support is disabled!');
                  }
                  115,
                  let crypto;
                  try {
                    crypto = await import('node:crypto');
                  } catch (err) {
                    console.error('crypto support is disabled!');
                  }
                  116,
                  let crypto;
                  try {
                    crypto = await import('node:crypto');
                  } catch (err) {
                    console.error('crypto support is disabled!');
                  }
                  117,
                  let crypto;
                  try {
                    crypto = await import('node:crypto');
                  } catch (err) {
                    console.error('crypto support is disabled!');
                  }
                  118, ________00___________117, ________0_____118, ________0077, ________0____118,
                  let crypto;
                  try {
                    crypto = await import('node:crypto');
                  } catch (err) {
                    console.error('crypto support is disabled!');
                  }
                  ________________110_110_117, __________11118, _______________________________________11

                Mengembalikan informasi tentang sandi yang diberikan

                Beberapa sandi menerima kunci panjang variabel dan vektor inisialisasi. Secara default, metode

                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                _122 akan mengembalikan nilai default untuk cipher ini. Untuk menguji apakah panjang kunci tertentu atau panjang iv dapat diterima untuk sandi yang diberikan, gunakan opsi
                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                109 dan
                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                108. Jika nilai yang diberikan tidak dapat diterima,
                import { createReadStream } from 'node:fs';
                import { stdout } from 'node:process';
                const { createHash } = await import('node:crypto');
                
                const hash = createHash('sha256');
                
                const input = createReadStream('test.js');
                input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
                const { createHash } = require('node:crypto');
                const { stdout } = require('node:process');
                
                const hash = createHash('sha256');
                
                const input = createReadStream('test.js');
                input.pipe(hash).setEncoding('hex').pipe(stdout);
                50 akan dikembalikan

                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                126

                • pengembalian. Larik dengan nama algoritme penyandian yang didukung

                const { Certificate } = await import('node:crypto');
                
                const cert1 = new Certificate();
                const cert2 = Certificate();const { Certificate } = require('node:crypto');
                
                const cert1 = new Certificate();
                const cert2 = Certificate();
                72

                • pengembalian. An array with the names of the supported elliptic curves

                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                128

                Creates a predefined

                const { Certificate } = await import('node:crypto');
                
                const cert1 = new Certificate();
                const cert2 = Certificate();const { Certificate } = require('node:crypto');
                
                const cert1 = new Certificate();
                const cert2 = Certificate();
                53 key exchange object. The supported groups are listed in the documentation for

                Objek yang dikembalikan meniru antarmuka objek yang dibuat oleh , tetapi tidak akan mengizinkan perubahan kunci (dengan , misalnya). Keuntungan menggunakan metode ini adalah bahwa para pihak tidak perlu membuat atau menukar modulus grup terlebih dahulu, menghemat waktu prosesor dan komunikasi

                Contoh (memperoleh rahasia bersama)

                const { X509Certificate } = await import('node:crypto');
                
                const x509 = new X509Certificate('{.. pem encoded cert ...}');
                
                console.log(x509.subject);const { X509Certificate } = require('node:crypto');
                
                const x509 = new X509Certificate('{.. pem encoded cert ...}');
                
                console.log(x509.subject);
                _82

                • pengembalian.
                  let crypto;
                  try {
                    crypto = await import('node:crypto');
                  } catch (err) {
                    console.error('crypto support is disabled!');
                  }
                  134 jika dan hanya jika penyedia kripto yang mematuhi FIPS sedang digunakan,
                  const { X509Certificate } = await import('node:crypto');
                  
                  const x509 = new X509Certificate('{.. pem encoded cert ...}');
                  
                  console.log(x509.subject);const { X509Certificate } = require('node:crypto');
                  
                  const x509 = new X509Certificate('{.. pem encoded cert ...}');
                  
                  console.log(x509.subject);
                  90 jika tidak. Rilis semver-major di masa mendatang dapat mengubah tipe pengembalian API ini menjadi a

                import { Buffer } from 'node:buffer';
                const { randomFill } = await import('node:crypto');
                
                const a = new Uint32Array(10);
                randomFill(a, (err, buf) => {
                  if (err) throw err;
                  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                    .toString('hex'));
                });
                
                const b = new DataView(new ArrayBuffer(10));
                randomFill(b, (err, buf) => {
                  if (err) throw err;
                  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                    .toString('hex'));
                });
                
                const c = new ArrayBuffer(10);
                randomFill(c, (err, buf) => {
                  if (err) throw err;
                  console.log(Buffer.from(buf).toString('hex'));
                });const { randomFill } = require('node:crypto');
                const { Buffer } = require('node:buffer');
                
                const a = new Uint32Array(10);
                randomFill(a, (err, buf) => {
                  if (err) throw err;
                  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                    .toString('hex'));
                });
                
                const b = new DataView(new ArrayBuffer(10));
                randomFill(b, (err, buf) => {
                  if (err) throw err;
                  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                    .toString('hex'));
                });
                
                const c = new ArrayBuffer(10);
                randomFill(c, (err, buf) => {
                  if (err) throw err;
                  console.log(Buffer.from(buf).toString('hex'));
                });
                26

                • pengembalian. Larik nama algoritme hash yang didukung, seperti
                  import { Buffer } from 'node:buffer';
                  const { randomFill } = await import('node:crypto');
                  
                  const a = new Uint32Array(10);
                  randomFill(a, (err, buf) => {
                    if (err) throw err;
                    console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                      .toString('hex'));
                  });
                  
                  const b = new DataView(new ArrayBuffer(10));
                  randomFill(b, (err, buf) => {
                    if (err) throw err;
                    console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                      .toString('hex'));
                  });
                  
                  const c = new ArrayBuffer(10);
                  randomFill(c, (err, buf) => {
                    if (err) throw err;
                    console.log(Buffer.from(buf).toString('hex'));
                  });const { randomFill } = require('node:crypto');
                  const { Buffer } = require('node:buffer');
                  
                  const a = new Uint32Array(10);
                  randomFill(a, (err, buf) => {
                    if (err) throw err;
                    console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                      .toString('hex'));
                  });
                  
                  const b = new DataView(new ArrayBuffer(10));
                  randomFill(b, (err, buf) => {
                    if (err) throw err;
                    console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                      .toString('hex'));
                  });
                  
                  const c = new ArrayBuffer(10);
                  randomFill(c, (err, buf) => {
                    if (err) throw err;
                    console.log(Buffer.from(buf).toString('hex'));
                  });
                  30. Algoritma hash juga disebut algoritma "intisari".

                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                _138

                Alias ​​​​yang nyaman untuk. Implementasi ini tidak sesuai dengan spesifikasi Web Crypto, sebagai gantinya untuk menulis kode yang kompatibel dengan web

                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                _141

                HistoryVersionChangesv18. 0. 0

                Melewati panggilan balik yang tidak valid ke argumen

                const { X509Certificate } = await import('node:crypto');
                
                const x509 = new X509Certificate('{.. pem encoded cert ...}');
                
                console.log(x509.subject);const { X509Certificate } = require('node:crypto');
                
                const x509 = new X509Certificate('{.. pem encoded cert ...}');
                
                console.log(x509.subject);
                84 sekarang melempar
                const { X509Certificate } = await import('node:crypto');
                
                const x509 = new X509Certificate('{.. pem encoded cert ...}');
                
                console.log(x509.subject);const { X509Certificate } = require('node:crypto');
                
                const x509 = new X509Certificate('{.. pem encoded cert ...}');
                
                console.log(x509.subject);
                85 alih-alih
                const { X509Certificate } = await import('node:crypto');
                
                const x509 = new X509Certificate('{.. pem encoded cert ...}');
                
                console.log(x509.subject);const { X509Certificate } = require('node:crypto');
                
                const x509 = new X509Certificate('{.. pem encoded cert ...}');
                
                console.log(x509.subject);
                86

                v18. 8. 0, v16. 18. 0

                Bahan input keying sekarang bisa menjadi nol-panjang

                v15. 0. 0

                ditambahkan. v15. 0. 0

                HKDF is a simple key derivation function defined in RFC 5869.

                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                145,
                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                146 dan
                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                147 yang diberikan digunakan dengan
                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                148 untuk mendapatkan kunci
                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                149 byte

                Fungsi

                const { X509Certificate } = await import('node:crypto');
                
                const x509 = new X509Certificate('{.. pem encoded cert ...}');
                
                console.log(x509.subject);const { X509Certificate } = require('node:crypto');
                
                const x509 = new X509Certificate('{.. pem encoded cert ...}');
                
                console.log(x509.subject);
                84 yang disediakan dipanggil dengan dua argumen.
                const { X509Certificate } = await import('node:crypto');
                
                const x509 = new X509Certificate('{.. pem encoded cert ...}');
                
                console.log(x509.subject);const { X509Certificate } = require('node:crypto');
                
                const x509 = new X509Certificate('{.. pem encoded cert ...}');
                
                console.log(x509.subject);
                95 dan
                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                152. Jika terjadi kesalahan saat menurunkan kunci,
                const { X509Certificate } = await import('node:crypto');
                
                const x509 = new X509Certificate('{.. pem encoded cert ...}');
                
                console.log(x509.subject);const { X509Certificate } = require('node:crypto');
                
                const x509 = new X509Certificate('{.. pem encoded cert ...}');
                
                console.log(x509.subject);
                95 akan disetel; .
                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                _152 yang berhasil dibuat akan diteruskan ke panggilan balik sebagai. An error will be thrown if any of the input arguments specify invalid values or types

                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                157

                HistoryVersionChangesv18. 8. 0, v16. 18. 0

                Bahan input keying sekarang bisa menjadi nol-panjang

                v15. 0. 0

                ditambahkan. v15. 0. 0

                Menyediakan fungsi derivasi kunci HKDF sinkron sebagaimana didefinisikan dalam RFC 5869.

                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                145,
                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                146 dan
                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                147 yang diberikan digunakan dengan
                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                148 untuk mendapatkan kunci
                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                149 byte

                The successfully generated

                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                152 will be returned as an

                Kesalahan akan terjadi jika salah satu argumen input menentukan nilai atau tipe yang tidak valid, atau jika kunci turunan tidak dapat dibuat

                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                _164

                HistoryVersionChangesv18. 0. 0

                Melewati panggilan balik yang tidak valid ke argumen

                const { X509Certificate } = await import('node:crypto');
                
                const x509 = new X509Certificate('{.. pem encoded cert ...}');
                
                console.log(x509.subject);const { X509Certificate } = require('node:crypto');
                
                const x509 = new X509Certificate('{.. pem encoded cert ...}');
                
                console.log(x509.subject);
                84 sekarang melempar
                const { X509Certificate } = await import('node:crypto');
                
                const x509 = new X509Certificate('{.. pem encoded cert ...}');
                
                console.log(x509.subject);const { X509Certificate } = require('node:crypto');
                
                const x509 = new X509Certificate('{.. pem encoded cert ...}');
                
                console.log(x509.subject);
                85 alih-alih
                const { X509Certificate } = await import('node:crypto');
                
                const x509 = new X509Certificate('{.. pem encoded cert ...}');
                
                console.log(x509.subject);const { X509Certificate } = require('node:crypto');
                
                const x509 = new X509Certificate('{.. pem encoded cert ...}');
                
                console.log(x509.subject);
                86

                v15. 0. 0

                The password and salt arguments can also be ArrayBuffer instances

                v14. 0. 0

                Parameter

                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                168 sekarang dibatasi ke nilai positif. Rilis sebelumnya memperlakukan nilai lain sebagai satu

                v8. 0. 0

                The

                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                148 parameter is always required now

                v6. 0. 0

                Memanggil fungsi ini tanpa meneruskan parameter

                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                _148 sudah tidak digunakan lagi sekarang dan akan mengeluarkan peringatan

                v6. 0. 0

                The default encoding for

                const {
                  generateKeyPairSync,
                } = await import('node:crypto');
                
                const {
                  publicKey,
                  privateKey,
                } = generateKeyPairSync('rsa', {
                  modulusLength: 4096,
                  publicKeyEncoding: {
                    type: 'spki',
                    format: 'pem',
                  },
                  privateKeyEncoding: {
                    type: 'pkcs8',
                    format: 'pem',
                    cipher: 'aes-256-cbc',
                    passphrase: 'top secret',
                  },
                });const {
                  generateKeyPairSync,
                } = require('node:crypto');
                
                const {
                  publicKey,
                  privateKey,
                } = generateKeyPairSync('rsa', {
                  modulusLength: 4096,
                  publicKeyEncoding: {
                    type: 'spki',
                    format: 'pem',
                  },
                  privateKeyEncoding: {
                    type: 'pkcs8',
                    format: 'pem',
                    cipher: 'aes-256-cbc',
                    passphrase: 'top secret',
                  },
                });
                17 if it is a string changed from
                import { Buffer } from 'node:buffer';
                const { randomFill } = await import('node:crypto');
                
                const a = new Uint32Array(10);
                randomFill(a, (err, buf) => {
                  if (err) throw err;
                  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                    .toString('hex'));
                });
                
                const b = new DataView(new ArrayBuffer(10));
                randomFill(b, (err, buf) => {
                  if (err) throw err;
                  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                    .toString('hex'));
                });
                
                const c = new ArrayBuffer(10);
                randomFill(c, (err, buf) => {
                  if (err) throw err;
                  console.log(Buffer.from(buf).toString('hex'));
                });const { randomFill } = require('node:crypto');
                const { Buffer } = require('node:buffer');
                
                const a = new Uint32Array(10);
                randomFill(a, (err, buf) => {
                  if (err) throw err;
                  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                    .toString('hex'));
                });
                
                const b = new DataView(new ArrayBuffer(10));
                randomFill(b, (err, buf) => {
                  if (err) throw err;
                  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                    .toString('hex'));
                });
                
                const c = new ArrayBuffer(10);
                randomFill(c, (err, buf) => {
                  if (err) throw err;
                  console.log(Buffer.from(buf).toString('hex'));
                });
                3 to
                import { Buffer } from 'node:buffer';
                const { randomFill } = await import('node:crypto');
                
                const a = new Uint32Array(10);
                randomFill(a, (err, buf) => {
                  if (err) throw err;
                  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                    .toString('hex'));
                });
                
                const b = new DataView(new ArrayBuffer(10));
                randomFill(b, (err, buf) => {
                  if (err) throw err;
                  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                    .toString('hex'));
                });
                
                const c = new ArrayBuffer(10);
                randomFill(c, (err, buf) => {
                  if (err) throw err;
                  console.log(Buffer.from(buf).toString('hex'));
                });const { randomFill } = require('node:crypto');
                const { Buffer } = require('node:buffer');
                
                const a = new Uint32Array(10);
                randomFill(a, (err, buf) => {
                  if (err) throw err;
                  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                    .toString('hex'));
                });
                
                const b = new DataView(new ArrayBuffer(10));
                randomFill(b, (err, buf) => {
                  if (err) throw err;
                  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                    .toString('hex'));
                });
                
                const c = new ArrayBuffer(10);
                randomFill(c, (err, buf) => {
                  if (err) throw err;
                  console.log(Buffer.from(buf).toString('hex'));
                });
                4

                v0. 5. 5

                Added in. v0. 5. 5

                Provides an asynchronous Password-Based Key Derivation Function 2 (PBKDF2) implementation. Algoritme intisari HMAC terpilih yang ditentukan oleh

                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                148 diterapkan untuk memperoleh kunci dengan panjang byte yang diminta (
                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                149) dari
                const {
                  generateKeyPairSync,
                } = await import('node:crypto');
                
                const {
                  publicKey,
                  privateKey,
                } = generateKeyPairSync('rsa', {
                  modulusLength: 4096,
                  publicKeyEncoding: {
                    type: 'spki',
                    format: 'pem',
                  },
                  privateKeyEncoding: {
                    type: 'pkcs8',
                    format: 'pem',
                    cipher: 'aes-256-cbc',
                    passphrase: 'top secret',
                  },
                });const {
                  generateKeyPairSync,
                } = require('node:crypto');
                
                const {
                  publicKey,
                  privateKey,
                } = generateKeyPairSync('rsa', {
                  modulusLength: 4096,
                  publicKeyEncoding: {
                    type: 'spki',
                    format: 'pem',
                  },
                  privateKeyEncoding: {
                    type: 'pkcs8',
                    format: 'pem',
                    cipher: 'aes-256-cbc',
                    passphrase: 'top secret',
                  },
                });
                17,
                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                146 dan
                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                168

                Fungsi

                const { X509Certificate } = await import('node:crypto');
                
                const x509 = new X509Certificate('{.. pem encoded cert ...}');
                
                console.log(x509.subject);const { X509Certificate } = require('node:crypto');
                
                const x509 = new X509Certificate('{.. pem encoded cert ...}');
                
                console.log(x509.subject);
                84 yang disediakan dipanggil dengan dua argumen.
                const { X509Certificate } = await import('node:crypto');
                
                const x509 = new X509Certificate('{.. pem encoded cert ...}');
                
                console.log(x509.subject);const { X509Certificate } = require('node:crypto');
                
                const x509 = new X509Certificate('{.. pem encoded cert ...}');
                
                console.log(x509.subject);
                95 and
                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                152. If an error occurs while deriving the key,
                const { X509Certificate } = await import('node:crypto');
                
                const x509 = new X509Certificate('{.. pem encoded cert ...}');
                
                console.log(x509.subject);const { X509Certificate } = require('node:crypto');
                
                const x509 = new X509Certificate('{.. pem encoded cert ...}');
                
                console.log(x509.subject);
                95 will be set; otherwise
                const { X509Certificate } = await import('node:crypto');
                
                const x509 = new X509Certificate('{.. pem encoded cert ...}');
                
                console.log(x509.subject);const { X509Certificate } = require('node:crypto');
                
                const x509 = new X509Certificate('{.. pem encoded cert ...}');
                
                console.log(x509.subject);
                95 will be
                const {
                  generateKeyPairSync,
                } = await import('node:crypto');
                
                const {
                  publicKey,
                  privateKey,
                } = generateKeyPairSync('rsa', {
                  modulusLength: 4096,
                  publicKeyEncoding: {
                    type: 'spki',
                    format: 'pem',
                  },
                  privateKeyEncoding: {
                    type: 'pkcs8',
                    format: 'pem',
                    cipher: 'aes-256-cbc',
                    passphrase: 'top secret',
                  },
                });const {
                  generateKeyPairSync,
                } = require('node:crypto');
                
                const {
                  publicKey,
                  privateKey,
                } = generateKeyPairSync('rsa', {
                  modulusLength: 4096,
                  publicKeyEncoding: {
                    type: 'spki',
                    format: 'pem',
                  },
                  privateKeyEncoding: {
                    type: 'pkcs8',
                    format: 'pem',
                    cipher: 'aes-256-cbc',
                    passphrase: 'top secret',
                  },
                });
                48. By default, the successfully generated
                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                152 will be passed to the callback as a
                import { createReadStream } from 'node:fs';
                import { stdout } from 'node:process';
                const {
                  createHmac,
                } = await import('node:crypto');
                
                const hmac = createHmac('sha256', 'a secret');
                
                const input = createReadStream('test.js');
                input.pipe(hmac).pipe(stdout);const {
                  createReadStream,
                } = require('node:fs');
                const {
                  createHmac,
                } = require('node:crypto');
                const { stdout } = require('node:process');
                
                const hmac = createHmac('sha256', 'a secret');
                
                const input = createReadStream('test.js');
                input.pipe(hmac).pipe(stdout);
                3. An error will be thrown if any of the input arguments specify invalid values or types

                The

                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                168 argument must be a number set as high as possible. Semakin tinggi jumlah iterasi, semakin aman kunci turunannya, tetapi akan membutuhkan waktu lebih lama untuk menyelesaikannya

                The

                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                146 should be as unique as possible. It is recommended that a salt is random and at least 16 bytes long. Lihat NIST SP 800-132 untuk detailnya.

                Saat meneruskan string untuk

                const {
                  generateKeyPairSync,
                } = await import('node:crypto');
                
                const {
                  publicKey,
                  privateKey,
                } = generateKeyPairSync('rsa', {
                  modulusLength: 4096,
                  publicKeyEncoding: {
                    type: 'spki',
                    format: 'pem',
                  },
                  privateKeyEncoding: {
                    type: 'pkcs8',
                    format: 'pem',
                    cipher: 'aes-256-cbc',
                    passphrase: 'top secret',
                  },
                });const {
                  generateKeyPairSync,
                } = require('node:crypto');
                
                const {
                  publicKey,
                  privateKey,
                } = generateKeyPairSync('rsa', {
                  modulusLength: 4096,
                  publicKeyEncoding: {
                    type: 'spki',
                    format: 'pem',
                  },
                  privateKeyEncoding: {
                    type: 'pkcs8',
                    format: 'pem',
                    cipher: 'aes-256-cbc',
                    passphrase: 'top secret',
                  },
                });
                _17 atau
                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                146, harap pertimbangkan

                Properti

                const { X509Certificate } = await import('node:crypto');
                
                const x509 = new X509Certificate('{.. pem encoded cert ...}');
                
                console.log(x509.subject);const { X509Certificate } = require('node:crypto');
                
                const x509 = new X509Certificate('{.. pem encoded cert ...}');
                
                console.log(x509.subject);
                _74 dapat digunakan untuk mengubah cara
                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                152 diteruskan ke callback. This property, however, has been deprecated and use should be avoided

                An array of supported digest functions can be retrieved using

                API ini menggunakan threadpool libuv, yang dapat memiliki implikasi kinerja yang mengejutkan dan negatif untuk beberapa aplikasi;

                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                195

                HistoryVersionChangesv14. 0. 0

                Parameter

                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                168 sekarang dibatasi ke nilai positif. Rilis sebelumnya memperlakukan nilai lain sebagai satu

                v6. 0. 0

                Memanggil fungsi ini tanpa meneruskan parameter

                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                _148 sudah tidak digunakan lagi sekarang dan akan mengeluarkan peringatan

                v6. 0. 0

                The default encoding for

                const {
                  generateKeyPairSync,
                } = await import('node:crypto');
                
                const {
                  publicKey,
                  privateKey,
                } = generateKeyPairSync('rsa', {
                  modulusLength: 4096,
                  publicKeyEncoding: {
                    type: 'spki',
                    format: 'pem',
                  },
                  privateKeyEncoding: {
                    type: 'pkcs8',
                    format: 'pem',
                    cipher: 'aes-256-cbc',
                    passphrase: 'top secret',
                  },
                });const {
                  generateKeyPairSync,
                } = require('node:crypto');
                
                const {
                  publicKey,
                  privateKey,
                } = generateKeyPairSync('rsa', {
                  modulusLength: 4096,
                  publicKeyEncoding: {
                    type: 'spki',
                    format: 'pem',
                  },
                  privateKeyEncoding: {
                    type: 'pkcs8',
                    format: 'pem',
                    cipher: 'aes-256-cbc',
                    passphrase: 'top secret',
                  },
                });
                17 if it is a string changed from
                import { Buffer } from 'node:buffer';
                const { randomFill } = await import('node:crypto');
                
                const a = new Uint32Array(10);
                randomFill(a, (err, buf) => {
                  if (err) throw err;
                  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                    .toString('hex'));
                });
                
                const b = new DataView(new ArrayBuffer(10));
                randomFill(b, (err, buf) => {
                  if (err) throw err;
                  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                    .toString('hex'));
                });
                
                const c = new ArrayBuffer(10);
                randomFill(c, (err, buf) => {
                  if (err) throw err;
                  console.log(Buffer.from(buf).toString('hex'));
                });const { randomFill } = require('node:crypto');
                const { Buffer } = require('node:buffer');
                
                const a = new Uint32Array(10);
                randomFill(a, (err, buf) => {
                  if (err) throw err;
                  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                    .toString('hex'));
                });
                
                const b = new DataView(new ArrayBuffer(10));
                randomFill(b, (err, buf) => {
                  if (err) throw err;
                  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                    .toString('hex'));
                });
                
                const c = new ArrayBuffer(10);
                randomFill(c, (err, buf) => {
                  if (err) throw err;
                  console.log(Buffer.from(buf).toString('hex'));
                });
                3 to
                import { Buffer } from 'node:buffer';
                const { randomFill } = await import('node:crypto');
                
                const a = new Uint32Array(10);
                randomFill(a, (err, buf) => {
                  if (err) throw err;
                  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                    .toString('hex'));
                });
                
                const b = new DataView(new ArrayBuffer(10));
                randomFill(b, (err, buf) => {
                  if (err) throw err;
                  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                    .toString('hex'));
                });
                
                const c = new ArrayBuffer(10);
                randomFill(c, (err, buf) => {
                  if (err) throw err;
                  console.log(Buffer.from(buf).toString('hex'));
                });const { randomFill } = require('node:crypto');
                const { Buffer } = require('node:buffer');
                
                const a = new Uint32Array(10);
                randomFill(a, (err, buf) => {
                  if (err) throw err;
                  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                    .toString('hex'));
                });
                
                const b = new DataView(new ArrayBuffer(10));
                randomFill(b, (err, buf) => {
                  if (err) throw err;
                  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                    .toString('hex'));
                });
                
                const c = new ArrayBuffer(10);
                randomFill(c, (err, buf) => {
                  if (err) throw err;
                  console.log(Buffer.from(buf).toString('hex'));
                });
                4

                v0. 9. 3

                Added in. v0. 9. 3

                Provides a synchronous Password-Based Key Derivation Function 2 (PBKDF2) implementation. A selected HMAC digest algorithm specified by

                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                148 is applied to derive a key of the requested byte length (
                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                149) from the
                const {
                  generateKeyPairSync,
                } = await import('node:crypto');
                
                const {
                  publicKey,
                  privateKey,
                } = generateKeyPairSync('rsa', {
                  modulusLength: 4096,
                  publicKeyEncoding: {
                    type: 'spki',
                    format: 'pem',
                  },
                  privateKeyEncoding: {
                    type: 'pkcs8',
                    format: 'pem',
                    cipher: 'aes-256-cbc',
                    passphrase: 'top secret',
                  },
                });const {
                  generateKeyPairSync,
                } = require('node:crypto');
                
                const {
                  publicKey,
                  privateKey,
                } = generateKeyPairSync('rsa', {
                  modulusLength: 4096,
                  publicKeyEncoding: {
                    type: 'spki',
                    format: 'pem',
                  },
                  privateKeyEncoding: {
                    type: 'pkcs8',
                    format: 'pem',
                    cipher: 'aes-256-cbc',
                    passphrase: 'top secret',
                  },
                });
                17,
                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                146 and
                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                168

                Jika terjadi kesalahan,

                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                206 akan dilempar, jika tidak, kunci turunan akan dikembalikan sebagai
                import { createReadStream } from 'node:fs';
                import { stdout } from 'node:process';
                const {
                  createHmac,
                } = await import('node:crypto');
                
                const hmac = createHmac('sha256', 'a secret');
                
                const input = createReadStream('test.js');
                input.pipe(hmac).pipe(stdout);const {
                  createReadStream,
                } = require('node:fs');
                const {
                  createHmac,
                } = require('node:crypto');
                const { stdout } = require('node:process');
                
                const hmac = createHmac('sha256', 'a secret');
                
                const input = createReadStream('test.js');
                input.pipe(hmac).pipe(stdout);
                3

                The

                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                168 argument must be a number set as high as possible. Semakin tinggi jumlah iterasi, semakin aman kunci turunannya, tetapi akan membutuhkan waktu lebih lama untuk menyelesaikannya

                The

                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                146 should be as unique as possible. It is recommended that a salt is random and at least 16 bytes long. Lihat NIST SP 800-132 untuk detailnya.

                Saat meneruskan string untuk

                const {
                  generateKeyPairSync,
                } = await import('node:crypto');
                
                const {
                  publicKey,
                  privateKey,
                } = generateKeyPairSync('rsa', {
                  modulusLength: 4096,
                  publicKeyEncoding: {
                    type: 'spki',
                    format: 'pem',
                  },
                  privateKeyEncoding: {
                    type: 'pkcs8',
                    format: 'pem',
                    cipher: 'aes-256-cbc',
                    passphrase: 'top secret',
                  },
                });const {
                  generateKeyPairSync,
                } = require('node:crypto');
                
                const {
                  publicKey,
                  privateKey,
                } = generateKeyPairSync('rsa', {
                  modulusLength: 4096,
                  publicKeyEncoding: {
                    type: 'spki',
                    format: 'pem',
                  },
                  privateKeyEncoding: {
                    type: 'pkcs8',
                    format: 'pem',
                    cipher: 'aes-256-cbc',
                    passphrase: 'top secret',
                  },
                });
                _17 atau
                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                146, harap pertimbangkan

                The

                const { X509Certificate } = await import('node:crypto');
                
                const x509 = new X509Certificate('{.. pem encoded cert ...}');
                
                console.log(x509.subject);const { X509Certificate } = require('node:crypto');
                
                const x509 = new X509Certificate('{.. pem encoded cert ...}');
                
                console.log(x509.subject);
                74 property may be used to change the way the
                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                152 is returned. Properti ini, bagaimanapun, sudah usang dan penggunaan harus dihindari

                An array of supported digest functions can be retrieved using

                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                _215

                HistoryVersionChangesv15. 0. 0

                Menambahkan string, ArrayBuffer, dan CryptoKey sebagai jenis kunci yang diizinkan. The oaepLabel can be an ArrayBuffer. The buffer can be a string or ArrayBuffer. Semua jenis yang menerima buffer dibatasi maksimal 2 ** 31 - 1 byte

                v12. sebelas. 0

                The

                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                216 option was added

                v12. 9. 0

                Opsi

                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                217 telah ditambahkan

                v11. 6. 0

                This function now supports key objects

                v0. sebelas. 14

                ditambahkan. v0. sebelas. 14

                Mendekripsi

                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                50 dengan
                const { Certificate } = await import('node:crypto');
                
                const cert1 = new Certificate();
                const cert2 = Certificate();const { Certificate } = require('node:crypto');
                
                const cert1 = new Certificate();
                const cert2 = Certificate();
                32.
                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                50 sebelumnya dienkripsi menggunakan kunci publik yang sesuai, misalnya menggunakan

                Jika

                const { Certificate } = await import('node:crypto');
                
                const cert1 = new Certificate();
                const cert2 = Certificate();const { Certificate } = require('node:crypto');
                
                const cert1 = new Certificate();
                const cert2 = Certificate();
                _32 bukan a , fungsi ini berperilaku seolah-olah
                const { Certificate } = await import('node:crypto');
                
                const cert1 = new Certificate();
                const cert2 = Certificate();const { Certificate } = require('node:crypto');
                
                const cert1 = new Certificate();
                const cert2 = Certificate();
                32 telah diteruskan ke. Jika objek, properti
                import { createReadStream } from 'node:fs';
                import { stdout } from 'node:process';
                const {
                  createHmac,
                } = await import('node:crypto');
                
                const hmac = createHmac('sha256', 'a secret');
                
                const input = createReadStream('test.js');
                input.pipe(hmac).pipe(stdout);const {
                  createReadStream,
                } = require('node:fs');
                const {
                  createHmac,
                } = require('node:crypto');
                const { stdout } = require('node:process');
                
                const hmac = createHmac('sha256', 'a secret');
                
                const input = createReadStream('test.js');
                input.pipe(hmac).pipe(stdout);
                30 dapat diteruskan. Jika tidak, fungsi ini menggunakan
                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                _227

                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                _228

                HistoryVersionChangesv15. 0. 0

                Menambahkan string, ArrayBuffer, dan CryptoKey sebagai jenis kunci yang diizinkan. Frasa sandi bisa berupa ArrayBuffer. Buffer bisa berupa string atau ArrayBuffer. Semua jenis yang menerima buffer dibatasi maksimal 2 ** 31 - 1 byte

                v11. 6. 0

                This function now supports key objects

                v1. 1. 0

                ditambahkan. v1. 1. 0

                Mengenkripsi

                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                50 dengan
                const { Certificate } = await import('node:crypto');
                
                const cert1 = new Certificate();
                const cert2 = Certificate();const { Certificate } = require('node:crypto');
                
                const cert1 = new Certificate();
                const cert2 = Certificate();
                32. Data yang dikembalikan dapat didekripsi menggunakan kunci publik yang sesuai, misalnya menggunakan

                Jika

                const { Certificate } = await import('node:crypto');
                
                const cert1 = new Certificate();
                const cert2 = Certificate();const { Certificate } = require('node:crypto');
                
                const cert1 = new Certificate();
                const cert2 = Certificate();
                _32 bukan a , fungsi ini berperilaku seolah-olah
                const { Certificate } = await import('node:crypto');
                
                const cert1 = new Certificate();
                const cert2 = Certificate();const { Certificate } = require('node:crypto');
                
                const cert1 = new Certificate();
                const cert2 = Certificate();
                32 telah diteruskan ke. Jika objek, properti
                import { createReadStream } from 'node:fs';
                import { stdout } from 'node:process';
                const {
                  createHmac,
                } = await import('node:crypto');
                
                const hmac = createHmac('sha256', 'a secret');
                
                const input = createReadStream('test.js');
                input.pipe(hmac).pipe(stdout);const {
                  createReadStream,
                } = require('node:fs');
                const {
                  createHmac,
                } = require('node:crypto');
                const { stdout } = require('node:process');
                
                const hmac = createHmac('sha256', 'a secret');
                
                const input = createReadStream('test.js');
                input.pipe(hmac).pipe(stdout);
                30 dapat diteruskan. Jika tidak, fungsi ini menggunakan
                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                _237

                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                _238

                HistoryVersionChangesv15. 0. 0

                Menambahkan string, ArrayBuffer, dan CryptoKey sebagai jenis kunci yang diizinkan. Frasa sandi bisa berupa ArrayBuffer. Buffer bisa berupa string atau ArrayBuffer. Semua jenis yang menerima buffer dibatasi maksimal 2 ** 31 - 1 byte

                v11. 6. 0

                This function now supports key objects

                v1. 1. 0

                ditambahkan. v1. 1. 0

                Mendekripsi

                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                50 dengan
                const { Certificate } = await import('node:crypto');
                
                const cert1 = new Certificate();
                const cert2 = Certificate();const { Certificate } = require('node:crypto');
                
                const cert1 = new Certificate();
                const cert2 = Certificate();
                63.
                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                50 sebelumnya dienkripsi menggunakan kunci pribadi yang sesuai, misalnya menggunakan

                Jika

                const { Certificate } = await import('node:crypto');
                
                const cert1 = new Certificate();
                const cert2 = Certificate();const { Certificate } = require('node:crypto');
                
                const cert1 = new Certificate();
                const cert2 = Certificate();
                _63 bukan a , fungsi ini berperilaku seolah-olah
                const { Certificate } = await import('node:crypto');
                
                const cert1 = new Certificate();
                const cert2 = Certificate();const { Certificate } = require('node:crypto');
                
                const cert1 = new Certificate();
                const cert2 = Certificate();
                63 telah diteruskan ke. Jika objek, properti
                import { createReadStream } from 'node:fs';
                import { stdout } from 'node:process';
                const {
                  createHmac,
                } = await import('node:crypto');
                
                const hmac = createHmac('sha256', 'a secret');
                
                const input = createReadStream('test.js');
                input.pipe(hmac).pipe(stdout);const {
                  createReadStream,
                } = require('node:fs');
                const {
                  createHmac,
                } = require('node:crypto');
                const { stdout } = require('node:process');
                
                const hmac = createHmac('sha256', 'a secret');
                
                const input = createReadStream('test.js');
                input.pipe(hmac).pipe(stdout);
                30 dapat diteruskan. Jika tidak, fungsi ini menggunakan
                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                _237

                Karena kunci publik RSA dapat diturunkan dari kunci privat, kunci privat dapat diteruskan sebagai pengganti kunci publik

                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                _249

                HistoryVersionChangesv15. 0. 0

                Menambahkan string, ArrayBuffer, dan CryptoKey sebagai jenis kunci yang diizinkan. The oaepLabel and passphrase can be ArrayBuffers. Buffer bisa berupa string atau ArrayBuffer. Semua jenis yang menerima buffer dibatasi maksimal 2 ** 31 - 1 byte

                v12. sebelas. 0

                The

                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                216 option was added

                v12. 9. 0

                Opsi

                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                217 telah ditambahkan

                v11. 6. 0

                This function now supports key objects

                v0. sebelas. 14

                ditambahkan. v0. sebelas. 14

                Mengenkripsi konten

                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                _50 dengan
                const { Certificate } = await import('node:crypto');
                
                const cert1 = new Certificate();
                const cert2 = Certificate();const { Certificate } = require('node:crypto');
                
                const cert1 = new Certificate();
                const cert2 = Certificate();
                63 dan mengembalikan
                import { createReadStream } from 'node:fs';
                import { stdout } from 'node:process';
                const {
                  createHmac,
                } = await import('node:crypto');
                
                const hmac = createHmac('sha256', 'a secret');
                
                const input = createReadStream('test.js');
                input.pipe(hmac).pipe(stdout);const {
                  createReadStream,
                } = require('node:fs');
                const {
                  createHmac,
                } = require('node:crypto');
                const { stdout } = require('node:process');
                
                const hmac = createHmac('sha256', 'a secret');
                
                const input = createReadStream('test.js');
                input.pipe(hmac).pipe(stdout);
                3 baru dengan konten terenkripsi. Data yang dikembalikan dapat didekripsi menggunakan kunci pribadi yang sesuai, misalnya menggunakan

                If

                const { Certificate } = await import('node:crypto');
                
                const cert1 = new Certificate();
                const cert2 = Certificate();const { Certificate } = require('node:crypto');
                
                const cert1 = new Certificate();
                const cert2 = Certificate();
                63 is not a , this function behaves as if
                const { Certificate } = await import('node:crypto');
                
                const cert1 = new Certificate();
                const cert2 = Certificate();const { Certificate } = require('node:crypto');
                
                const cert1 = new Certificate();
                const cert2 = Certificate();
                63 had been passed to . Jika objek, properti
                import { createReadStream } from 'node:fs';
                import { stdout } from 'node:process';
                const {
                  createHmac,
                } = await import('node:crypto');
                
                const hmac = createHmac('sha256', 'a secret');
                
                const input = createReadStream('test.js');
                input.pipe(hmac).pipe(stdout);const {
                  createReadStream,
                } = require('node:fs');
                const {
                  createHmac,
                } = require('node:crypto');
                const { stdout } = require('node:process');
                
                const hmac = createHmac('sha256', 'a secret');
                
                const input = createReadStream('test.js');
                input.pipe(hmac).pipe(stdout);
                30 dapat diteruskan. Otherwise, this function uses
                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                227

                Karena kunci publik RSA dapat diturunkan dari kunci privat, kunci privat dapat diteruskan sebagai pengganti kunci publik

                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                _262

                HistoryVersionChangesv18. 0. 0

                Melewati panggilan balik yang tidak valid ke argumen

                const { X509Certificate } = await import('node:crypto');
                
                const x509 = new X509Certificate('{.. pem encoded cert ...}');
                
                console.log(x509.subject);const { X509Certificate } = require('node:crypto');
                
                const x509 = new X509Certificate('{.. pem encoded cert ...}');
                
                console.log(x509.subject);
                84 sekarang melempar
                const { X509Certificate } = await import('node:crypto');
                
                const x509 = new X509Certificate('{.. pem encoded cert ...}');
                
                console.log(x509.subject);const { X509Certificate } = require('node:crypto');
                
                const x509 = new X509Certificate('{.. pem encoded cert ...}');
                
                console.log(x509.subject);
                85 alih-alih
                const { X509Certificate } = await import('node:crypto');
                
                const x509 = new X509Certificate('{.. pem encoded cert ...}');
                
                console.log(x509.subject);const { X509Certificate } = require('node:crypto');
                
                const x509 = new X509Certificate('{.. pem encoded cert ...}');
                
                console.log(x509.subject);
                86

                v9. 0. 0

                Melewati

                const {
                  generateKeyPairSync,
                } = await import('node:crypto');
                
                const {
                  publicKey,
                  privateKey,
                } = generateKeyPairSync('rsa', {
                  modulusLength: 4096,
                  publicKeyEncoding: {
                    type: 'spki',
                    format: 'pem',
                  },
                  privateKeyEncoding: {
                    type: 'pkcs8',
                    format: 'pem',
                    cipher: 'aes-256-cbc',
                    passphrase: 'top secret',
                  },
                });const {
                  generateKeyPairSync,
                } = require('node:crypto');
                
                const {
                  publicKey,
                  privateKey,
                } = generateKeyPairSync('rsa', {
                  modulusLength: 4096,
                  publicKeyEncoding: {
                    type: 'spki',
                    format: 'pem',
                  },
                  privateKeyEncoding: {
                    type: 'pkcs8',
                    format: 'pem',
                    cipher: 'aes-256-cbc',
                    passphrase: 'top secret',
                  },
                });
                48 sebagai
                const { X509Certificate } = await import('node:crypto');
                
                const x509 = new X509Certificate('{.. pem encoded cert ...}');
                
                console.log(x509.subject);const { X509Certificate } = require('node:crypto');
                
                const x509 = new X509Certificate('{.. pem encoded cert ...}');
                
                console.log(x509.subject);
                84 argumen sekarang melempar
                const { X509Certificate } = await import('node:crypto');
                
                const x509 = new X509Certificate('{.. pem encoded cert ...}');
                
                console.log(x509.subject);const { X509Certificate } = require('node:crypto');
                
                const x509 = new X509Certificate('{.. pem encoded cert ...}');
                
                console.log(x509.subject);
                86

                v0. 5. 8

                ditambahkan. v0. 5. 8

                • let crypto;
                  try {
                    crypto = await import('node:crypto');
                  } catch (err) {
                    console.error('crypto support is disabled!');
                  }
                  _037 Jumlah byte yang dihasilkan.
                  let crypto;
                  try {
                    crypto = await import('node:crypto');
                  } catch (err) {
                    console.error('crypto support is disabled!');
                  }
                  037 tidak boleh lebih besar dari
                  let crypto;
                  try {
                    crypto = await import('node:crypto');
                  } catch (err) {
                    console.error('crypto support is disabled!');
                  }
                  271
                • const { X509Certificate } = await import('node:crypto');
                  
                  const x509 = new X509Certificate('{.. pem encoded cert ...}');
                  
                  console.log(x509.subject);const { X509Certificate } = require('node:crypto');
                  
                  const x509 = new X509Certificate('{.. pem encoded cert ...}');
                  
                  console.log(x509.subject);
                  _84
                • Returns. jika fungsi
                  const { X509Certificate } = await import('node:crypto');
                  
                  const x509 = new X509Certificate('{.. pem encoded cert ...}');
                  
                  console.log(x509.subject);const { X509Certificate } = require('node:crypto');
                  
                  const x509 = new X509Certificate('{.. pem encoded cert ...}');
                  
                  console.log(x509.subject);
                  _84 tidak tersedia

                Menghasilkan data pseudorandom yang kuat secara kriptografis. The

                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                037 argument is a number indicating the number of bytes to generate

                Jika fungsi

                const { X509Certificate } = await import('node:crypto');
                
                const x509 = new X509Certificate('{.. pem encoded cert ...}');
                
                console.log(x509.subject);const { X509Certificate } = require('node:crypto');
                
                const x509 = new X509Certificate('{.. pem encoded cert ...}');
                
                console.log(x509.subject);
                84 disediakan, byte dihasilkan secara asinkron dan fungsi
                const { X509Certificate } = await import('node:crypto');
                
                const x509 = new X509Certificate('{.. pem encoded cert ...}');
                
                console.log(x509.subject);const { X509Certificate } = require('node:crypto');
                
                const x509 = new X509Certificate('{.. pem encoded cert ...}');
                
                console.log(x509.subject);
                84 dipanggil dengan dua argumen.
                const { X509Certificate } = await import('node:crypto');
                
                const x509 = new X509Certificate('{.. pem encoded cert ...}');
                
                console.log(x509.subject);const { X509Certificate } = require('node:crypto');
                
                const x509 = new X509Certificate('{.. pem encoded cert ...}');
                
                console.log(x509.subject);
                95 dan
                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                278. Jika terjadi kesalahan,
                const { X509Certificate } = await import('node:crypto');
                
                const x509 = new X509Certificate('{.. pem encoded cert ...}');
                
                console.log(x509.subject);const { X509Certificate } = require('node:crypto');
                
                const x509 = new X509Certificate('{.. pem encoded cert ...}');
                
                console.log(x509.subject);
                _95 akan menjadi objek
                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                206; . Argumen
                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                278 adalah
                import { createReadStream } from 'node:fs';
                import { stdout } from 'node:process';
                const {
                  createHmac,
                } = await import('node:crypto');
                
                const hmac = createHmac('sha256', 'a secret');
                
                const input = createReadStream('test.js');
                input.pipe(hmac).pipe(stdout);const {
                  createReadStream,
                } = require('node:fs');
                const {
                  createHmac,
                } = require('node:crypto');
                const { stdout } = require('node:process');
                
                const hmac = createHmac('sha256', 'a secret');
                
                const input = createReadStream('test.js');
                input.pipe(hmac).pipe(stdout);
                3 berisi byte yang dihasilkan

                Jika fungsi

                const { X509Certificate } = await import('node:crypto');
                
                const x509 = new X509Certificate('{.. pem encoded cert ...}');
                
                console.log(x509.subject);const { X509Certificate } = require('node:crypto');
                
                const x509 = new X509Certificate('{.. pem encoded cert ...}');
                
                console.log(x509.subject);
                84 tidak disediakan, byte acak dibuat secara sinkron dan dikembalikan sebagai
                import { createReadStream } from 'node:fs';
                import { stdout } from 'node:process';
                const {
                  createHmac,
                } = await import('node:crypto');
                
                const hmac = createHmac('sha256', 'a secret');
                
                const input = createReadStream('test.js');
                input.pipe(hmac).pipe(stdout);const {
                  createReadStream,
                } = require('node:fs');
                const {
                  createHmac,
                } = require('node:crypto');
                const { stdout } = require('node:process');
                
                const hmac = createHmac('sha256', 'a secret');
                
                const input = createReadStream('test.js');
                input.pipe(hmac).pipe(stdout);
                3. Kesalahan akan dilemparkan jika ada masalah dalam menghasilkan byte

                The

                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                286 method will not complete until there is sufficient entropy available. Ini biasanya tidak akan memakan waktu lebih dari beberapa milidetik. Satu-satunya waktu ketika menghasilkan byte acak dapat diblokir untuk jangka waktu yang lebih lama adalah tepat setelah boot, ketika seluruh sistem masih kekurangan entropi.

                API ini menggunakan threadpool libuv, yang dapat memiliki implikasi kinerja yang mengejutkan dan negatif untuk beberapa aplikasi;

                Versi asinkron dari

                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                286 dijalankan dalam satu permintaan threadpool. Untuk meminimalkan variasi panjang tugas threadpool, partisi besar
                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                289 permintaan saat melakukannya sebagai bagian dari memenuhi permintaan klien

                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                _290

                HistoryVersionChangesv9. 0. 0

                Argumen

                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                50 dapat berupa
                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                01 atau
                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                02

                v7. 10. 0.v6. 13. 0

                ditambahkan. v7. 10. 0.v6. 13. 0

                Synchronous version of

                Contoh

                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                061,
                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                01 atau
                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                02 dapat diteruskan sebagai
                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                50

                import { Buffer } from 'node:buffer';
                const { randomFillSync } = await import('node:crypto');
                
                const a = new Uint32Array(10);
                console.log(Buffer.from(randomFillSync(a).buffer,
                                        a.byteOffset, a.byteLength).toString('hex'));
                
                const b = new DataView(new ArrayBuffer(10));
                console.log(Buffer.from(randomFillSync(b).buffer,
                                        b.byteOffset, b.byteLength).toString('hex'));
                
                const c = new ArrayBuffer(10);
                console.log(Buffer.from(randomFillSync(c)).toString('hex'));const { randomFillSync } = require('node:crypto');
                const { Buffer } = require('node:buffer');
                
                const a = new Uint32Array(10);
                console.log(Buffer.from(randomFillSync(a).buffer,
                                        a.byteOffset, a.byteLength).toString('hex'));
                
                const b = new DataView(new ArrayBuffer(10));
                console.log(Buffer.from(randomFillSync(b).buffer,
                                        b.byteOffset, b.byteLength).toString('hex'));
                
                const c = new ArrayBuffer(10);
                console.log(Buffer.from(randomFillSync(c)).toString('hex'));

                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                299

                HistoryVersionChangesv18. 0. 0

                Melewati panggilan balik yang tidak valid ke argumen

                const { X509Certificate } = await import('node:crypto');
                
                const x509 = new X509Certificate('{.. pem encoded cert ...}');
                
                console.log(x509.subject);const { X509Certificate } = require('node:crypto');
                
                const x509 = new X509Certificate('{.. pem encoded cert ...}');
                
                console.log(x509.subject);
                84 sekarang melempar
                const { X509Certificate } = await import('node:crypto');
                
                const x509 = new X509Certificate('{.. pem encoded cert ...}');
                
                console.log(x509.subject);const { X509Certificate } = require('node:crypto');
                
                const x509 = new X509Certificate('{.. pem encoded cert ...}');
                
                console.log(x509.subject);
                85 alih-alih
                const { X509Certificate } = await import('node:crypto');
                
                const x509 = new X509Certificate('{.. pem encoded cert ...}');
                
                console.log(x509.subject);const { X509Certificate } = require('node:crypto');
                
                const x509 = new X509Certificate('{.. pem encoded cert ...}');
                
                console.log(x509.subject);
                86

                v9. 0. 0

                Argumen

                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                50 dapat berupa
                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                01 atau
                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                02

                v7. 10. 0.v6. 13. 0

                ditambahkan. v7. 10. 0.v6. 13. 0

                Fungsi ini mirip dengan tetapi membutuhkan argumen pertama berupa

                import { createReadStream } from 'node:fs';
                import { stdout } from 'node:process';
                const {
                  createHmac,
                } = await import('node:crypto');
                
                const hmac = createHmac('sha256', 'a secret');
                
                const input = createReadStream('test.js');
                input.pipe(hmac).pipe(stdout);const {
                  createReadStream,
                } = require('node:fs');
                const {
                  createHmac,
                } = require('node:crypto');
                const { stdout } = require('node:process');
                
                const hmac = createHmac('sha256', 'a secret');
                
                const input = createReadStream('test.js');
                input.pipe(hmac).pipe(stdout);
                3 yang akan diisi. Itu juga mengharuskan panggilan balik diteruskan

                Jika fungsi

                const { X509Certificate } = await import('node:crypto');
                
                const x509 = new X509Certificate('{.. pem encoded cert ...}');
                
                console.log(x509.subject);const { X509Certificate } = require('node:crypto');
                
                const x509 = new X509Certificate('{.. pem encoded cert ...}');
                
                console.log(x509.subject);
                _84 tidak disediakan, kesalahan akan terjadi

                Contoh

                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                _061,
                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                01, atau
                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                02 dapat diteruskan sebagai
                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                50

                Meskipun ini termasuk contoh

                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                313 dan
                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                314, fungsi ini tidak boleh digunakan untuk menghasilkan angka floating-point acak. Hasilnya mungkin berisi
                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                315,
                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                316, dan
                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                317, dan bahkan jika array berisi bilangan terbatas saja, mereka tidak diambil dari distribusi acak yang seragam dan tidak memiliki batas bawah atau atas yang berarti

                import { Buffer } from 'node:buffer';
                const { randomFill } = await import('node:crypto');
                
                const a = new Uint32Array(10);
                randomFill(a, (err, buf) => {
                  if (err) throw err;
                  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                    .toString('hex'));
                });
                
                const b = new DataView(new ArrayBuffer(10));
                randomFill(b, (err, buf) => {
                  if (err) throw err;
                  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                    .toString('hex'));
                });
                
                const c = new ArrayBuffer(10);
                randomFill(c, (err, buf) => {
                  if (err) throw err;
                  console.log(Buffer.from(buf).toString('hex'));
                });const { randomFill } = require('node:crypto');
                const { Buffer } = require('node:buffer');
                
                const a = new Uint32Array(10);
                randomFill(a, (err, buf) => {
                  if (err) throw err;
                  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                    .toString('hex'));
                });
                
                const b = new DataView(new ArrayBuffer(10));
                randomFill(b, (err, buf) => {
                  if (err) throw err;
                  console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                    .toString('hex'));
                });
                
                const c = new ArrayBuffer(10);
                randomFill(c, (err, buf) => {
                  if (err) throw err;
                  console.log(Buffer.from(buf).toString('hex'));
                });

                API ini menggunakan threadpool libuv, yang dapat memiliki implikasi kinerja yang mengejutkan dan negatif untuk beberapa aplikasi;

                Versi asinkron dari

                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                294 dijalankan dalam satu permintaan threadpool. Untuk meminimalkan variasi panjang tugas threadpool, partisi permintaan
                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                320 besar saat melakukannya sebagai bagian dari pemenuhan permintaan klien

                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                _321

                HistoryVersionChangesv18. 0. 0

                Melewati panggilan balik yang tidak valid ke argumen

                const { X509Certificate } = await import('node:crypto');
                
                const x509 = new X509Certificate('{.. pem encoded cert ...}');
                
                console.log(x509.subject);const { X509Certificate } = require('node:crypto');
                
                const x509 = new X509Certificate('{.. pem encoded cert ...}');
                
                console.log(x509.subject);
                84 sekarang melempar
                const { X509Certificate } = await import('node:crypto');
                
                const x509 = new X509Certificate('{.. pem encoded cert ...}');
                
                console.log(x509.subject);const { X509Certificate } = require('node:crypto');
                
                const x509 = new X509Certificate('{.. pem encoded cert ...}');
                
                console.log(x509.subject);
                85 alih-alih
                const { X509Certificate } = await import('node:crypto');
                
                const x509 = new X509Certificate('{.. pem encoded cert ...}');
                
                console.log(x509.subject);const { X509Certificate } = require('node:crypto');
                
                const x509 = new X509Certificate('{.. pem encoded cert ...}');
                
                console.log(x509.subject);
                86

                v14. 10. 0.v12. 19. 0

                ditambahkan. v14. 10. 0.v12. 19. 0

                Mengembalikan bilangan bulat acak

                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                _325 sehingga
                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                326. Implementasi ini menghindari

                Rentang (

                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                _327) harus kurang dari 248.
                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                _328 dan
                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                329 harus bilangan bulat yang aman

                Jika fungsi

                const { X509Certificate } = await import('node:crypto');
                
                const x509 = new X509Certificate('{.. pem encoded cert ...}');
                
                console.log(x509.subject);const { X509Certificate } = require('node:crypto');
                
                const x509 = new X509Certificate('{.. pem encoded cert ...}');
                
                console.log(x509.subject);
                _84 tidak disediakan, bilangan bulat acak dihasilkan secara sinkron

                let crypto;
                try {
                  crypto = await import('node:crypto');
                } catch (err) {
                  console.error('crypto support is disabled!');
                }
                _331

                ditambahkan. v15. 6. 0.v14. 17. 0

                • let crypto;
                  try {
                    crypto = await import('node:crypto');
                  } catch (err) {
                    console.error('crypto support is disabled!');
                  }
                  44
                  • let crypto;
                    try {
                      crypto = await import('node:crypto');
                    } catch (err) {
                      console.error('crypto support is disabled!');
                    }
                    _333 Secara default, untuk meningkatkan kinerja, Node. js menghasilkan dan menyimpan data acak yang cukup untuk menghasilkan hingga 128 UUID acak. Untuk menghasilkan UUID tanpa menggunakan cache, atur
                    let crypto;
                    try {
                      crypto = await import('node:crypto');
                    } catch (err) {
                      console.error('crypto support is disabled!');
                    }
                    333 ke
                    import { createReadStream } from 'node:fs';
                    import { stdout } from 'node:process';
                    const { createHash } = await import('node:crypto');
                    
                    const hash = createHash('sha256');
                    
                    const input = createReadStream('test.js');
                    input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
                    const { createHash } = require('node:crypto');
                    const { stdout } = require('node:process');
                    
                    const hash = createHash('sha256');
                    
                    const input = createReadStream('test.js');
                    input.pipe(hash).setEncoding('hex').pipe(stdout);
                    99. Bawaan.
                    import { Buffer } from 'node:buffer';
                    const { randomFillSync } = await import('node:crypto');
                    
                    const a = new Uint32Array(10);
                    console.log(Buffer.from(randomFillSync(a).buffer,
                                            a.byteOffset, a.byteLength).toString('hex'));
                    
                    const b = new DataView(new ArrayBuffer(10));
                    console.log(Buffer.from(randomFillSync(b).buffer,
                                            b.byteOffset, b.byteLength).toString('hex'));
                    
                    const c = new ArrayBuffer(10);
                    console.log(Buffer.from(randomFillSync(c)).toString('hex'));const { randomFillSync } = require('node:crypto');
                    const { Buffer } = require('node:buffer');
                    
                    const a = new Uint32Array(10);
                    console.log(Buffer.from(randomFillSync(a).buffer,
                                            a.byteOffset, a.byteLength).toString('hex'));
                    
                    const b = new DataView(new ArrayBuffer(10));
                    console.log(Buffer.from(randomFillSync(b).buffer,
                                            b.byteOffset, b.byteLength).toString('hex'));
                    
                    const c = new ArrayBuffer(10);
                    console.log(Buffer.from(randomFillSync(c)).toString('hex'));
                    6
                • Returns.
                • Menghasilkan UUID RFC 4122 versi 4 acak. UUID dihasilkan menggunakan generator nomor pseudorandom kriptografi

                  let crypto;
                  try {
                    crypto = await import('node:crypto');
                  } catch (err) {
                    console.error('crypto support is disabled!');
                  }
                  _337

                  HistoryVersionChangesv18. 0. 0

                  Melewati panggilan balik yang tidak valid ke argumen

                  const { X509Certificate } = await import('node:crypto');
                  
                  const x509 = new X509Certificate('{.. pem encoded cert ...}');
                  
                  console.log(x509.subject);const { X509Certificate } = require('node:crypto');
                  
                  const x509 = new X509Certificate('{.. pem encoded cert ...}');
                  
                  console.log(x509.subject);
                  84 sekarang melempar
                  const { X509Certificate } = await import('node:crypto');
                  
                  const x509 = new X509Certificate('{.. pem encoded cert ...}');
                  
                  console.log(x509.subject);const { X509Certificate } = require('node:crypto');
                  
                  const x509 = new X509Certificate('{.. pem encoded cert ...}');
                  
                  console.log(x509.subject);
                  85 alih-alih
                  const { X509Certificate } = await import('node:crypto');
                  
                  const x509 = new X509Certificate('{.. pem encoded cert ...}');
                  
                  console.log(x509.subject);const { X509Certificate } = require('node:crypto');
                  
                  const x509 = new X509Certificate('{.. pem encoded cert ...}');
                  
                  console.log(x509.subject);
                  86

                  v15. 0. 0

                  The password and salt arguments can also be ArrayBuffer instances

                  v12. 8. 0,v10. 17. 0

                  Nilai

                  let crypto;
                  try {
                    crypto = await import('node:crypto');
                  } catch (err) {
                    console.error('crypto support is disabled!');
                  }
                  341 sekarang dapat berupa bilangan bulat aman apa saja

                  v10. 9. 0

                  Nama opsi

                  let crypto;
                  try {
                    crypto = await import('node:crypto');
                  } catch (err) {
                    console.error('crypto support is disabled!');
                  }
                  342,
                  let crypto;
                  try {
                    crypto = await import('node:crypto');
                  } catch (err) {
                    console.error('crypto support is disabled!');
                  }
                  105 dan
                  let crypto;
                  try {
                    crypto = await import('node:crypto');
                  } catch (err) {
                    console.error('crypto support is disabled!');
                  }
                  344 telah ditambahkan

                  v10. 5. 0

                  ditambahkan. v10. 5. 0

                  Menyediakan implementasi crypt asinkron. Scrypt adalah fungsi derivasi kunci berbasis kata sandi yang dirancang untuk menjadi mahal secara komputasi dan memori untuk membuat serangan brute-force tidak menguntungkan

                  The

                  let crypto;
                  try {
                    crypto = await import('node:crypto');
                  } catch (err) {
                    console.error('crypto support is disabled!');
                  }
                  146 should be as unique as possible. It is recommended that a salt is random and at least 16 bytes long. Lihat NIST SP 800-132 untuk detailnya.

                  Saat meneruskan string untuk

                  const {
                    generateKeyPairSync,
                  } = await import('node:crypto');
                  
                  const {
                    publicKey,
                    privateKey,
                  } = generateKeyPairSync('rsa', {
                    modulusLength: 4096,
                    publicKeyEncoding: {
                      type: 'spki',
                      format: 'pem',
                    },
                    privateKeyEncoding: {
                      type: 'pkcs8',
                      format: 'pem',
                      cipher: 'aes-256-cbc',
                      passphrase: 'top secret',
                    },
                  });const {
                    generateKeyPairSync,
                  } = require('node:crypto');
                  
                  const {
                    publicKey,
                    privateKey,
                  } = generateKeyPairSync('rsa', {
                    modulusLength: 4096,
                    publicKeyEncoding: {
                      type: 'spki',
                      format: 'pem',
                    },
                    privateKeyEncoding: {
                      type: 'pkcs8',
                      format: 'pem',
                      cipher: 'aes-256-cbc',
                      passphrase: 'top secret',
                    },
                  });
                  _17 atau
                  let crypto;
                  try {
                    crypto = await import('node:crypto');
                  } catch (err) {
                    console.error('crypto support is disabled!');
                  }
                  146, harap pertimbangkan

                  Fungsi

                  const { X509Certificate } = await import('node:crypto');
                  
                  const x509 = new X509Certificate('{.. pem encoded cert ...}');
                  
                  console.log(x509.subject);const { X509Certificate } = require('node:crypto');
                  
                  const x509 = new X509Certificate('{.. pem encoded cert ...}');
                  
                  console.log(x509.subject);
                  _84 dipanggil dengan dua argumen.
                  const { X509Certificate } = await import('node:crypto');
                  
                  const x509 = new X509Certificate('{.. pem encoded cert ...}');
                  
                  console.log(x509.subject);const { X509Certificate } = require('node:crypto');
                  
                  const x509 = new X509Certificate('{.. pem encoded cert ...}');
                  
                  console.log(x509.subject);
                  95 dan
                  let crypto;
                  try {
                    crypto = await import('node:crypto');
                  } catch (err) {
                    console.error('crypto support is disabled!');
                  }
                  152.
                  const { X509Certificate } = await import('node:crypto');
                  
                  const x509 = new X509Certificate('{.. pem encoded cert ...}');
                  
                  console.log(x509.subject);const { X509Certificate } = require('node:crypto');
                  
                  const x509 = new X509Certificate('{.. pem encoded cert ...}');
                  
                  console.log(x509.subject);
                  95 adalah objek pengecualian ketika penurunan kunci gagal, jika tidak
                  const { X509Certificate } = await import('node:crypto');
                  
                  const x509 = new X509Certificate('{.. pem encoded cert ...}');
                  
                  console.log(x509.subject);const { X509Certificate } = require('node:crypto');
                  
                  const x509 = new X509Certificate('{.. pem encoded cert ...}');
                  
                  console.log(x509.subject);
                  95 adalah
                  const {
                    generateKeyPairSync,
                  } = await import('node:crypto');
                  
                  const {
                    publicKey,
                    privateKey,
                  } = generateKeyPairSync('rsa', {
                    modulusLength: 4096,
                    publicKeyEncoding: {
                      type: 'spki',
                      format: 'pem',
                    },
                    privateKeyEncoding: {
                      type: 'pkcs8',
                      format: 'pem',
                      cipher: 'aes-256-cbc',
                      passphrase: 'top secret',
                    },
                  });const {
                    generateKeyPairSync,
                  } = require('node:crypto');
                  
                  const {
                    publicKey,
                    privateKey,
                  } = generateKeyPairSync('rsa', {
                    modulusLength: 4096,
                    publicKeyEncoding: {
                      type: 'spki',
                      format: 'pem',
                    },
                    privateKeyEncoding: {
                      type: 'pkcs8',
                      format: 'pem',
                      cipher: 'aes-256-cbc',
                      passphrase: 'top secret',
                    },
                  });
                  48.
                  let crypto;
                  try {
                    crypto = await import('node:crypto');
                  } catch (err) {
                    console.error('crypto support is disabled!');
                  }
                  _152 diteruskan ke callback sebagai
                  import { createReadStream } from 'node:fs';
                  import { stdout } from 'node:process';
                  const {
                    createHmac,
                  } = await import('node:crypto');
                  
                  const hmac = createHmac('sha256', 'a secret');
                  
                  const input = createReadStream('test.js');
                  input.pipe(hmac).pipe(stdout);const {
                    createReadStream,
                  } = require('node:fs');
                  const {
                    createHmac,
                  } = require('node:crypto');
                  const { stdout } = require('node:process');
                  
                  const hmac = createHmac('sha256', 'a secret');
                  
                  const input = createReadStream('test.js');
                  input.pipe(hmac).pipe(stdout);
                  3

                  Pengecualian dilemparkan ketika salah satu argumen input menentukan nilai atau tipe yang tidak valid

                  let crypto;
                  try {
                    crypto = await import('node:crypto');
                  } catch (err) {
                    console.error('crypto support is disabled!');
                  }
                  _356

                  HistoryVersionChangesv12. 8. 0,v10. 17. 0

                  Nilai

                  let crypto;
                  try {
                    crypto = await import('node:crypto');
                  } catch (err) {
                    console.error('crypto support is disabled!');
                  }
                  341 sekarang dapat berupa bilangan bulat aman apa saja

                  v10. 9. 0

                  Nama opsi

                  let crypto;
                  try {
                    crypto = await import('node:crypto');
                  } catch (err) {
                    console.error('crypto support is disabled!');
                  }
                  342,
                  let crypto;
                  try {
                    crypto = await import('node:crypto');
                  } catch (err) {
                    console.error('crypto support is disabled!');
                  }
                  105 dan
                  let crypto;
                  try {
                    crypto = await import('node:crypto');
                  } catch (err) {
                    console.error('crypto support is disabled!');
                  }
                  344 telah ditambahkan

                  v10. 5. 0

                  ditambahkan. v10. 5. 0

                  Menyediakan implementasi scrypt sinkron. Scrypt adalah fungsi derivasi kunci berbasis kata sandi yang dirancang untuk menjadi mahal secara komputasi dan memori untuk membuat serangan brute-force tidak menguntungkan

                  The

                  let crypto;
                  try {
                    crypto = await import('node:crypto');
                  } catch (err) {
                    console.error('crypto support is disabled!');
                  }
                  146 should be as unique as possible. It is recommended that a salt is random and at least 16 bytes long. Lihat NIST SP 800-132 untuk detailnya.

                  Saat meneruskan string untuk

                  const {
                    generateKeyPairSync,
                  } = await import('node:crypto');
                  
                  const {
                    publicKey,
                    privateKey,
                  } = generateKeyPairSync('rsa', {
                    modulusLength: 4096,
                    publicKeyEncoding: {
                      type: 'spki',
                      format: 'pem',
                    },
                    privateKeyEncoding: {
                      type: 'pkcs8',
                      format: 'pem',
                      cipher: 'aes-256-cbc',
                      passphrase: 'top secret',
                    },
                  });const {
                    generateKeyPairSync,
                  } = require('node:crypto');
                  
                  const {
                    publicKey,
                    privateKey,
                  } = generateKeyPairSync('rsa', {
                    modulusLength: 4096,
                    publicKeyEncoding: {
                      type: 'spki',
                      format: 'pem',
                    },
                    privateKeyEncoding: {
                      type: 'pkcs8',
                      format: 'pem',
                      cipher: 'aes-256-cbc',
                      passphrase: 'top secret',
                    },
                  });
                  _17 atau
                  let crypto;
                  try {
                    crypto = await import('node:crypto');
                  } catch (err) {
                    console.error('crypto support is disabled!');
                  }
                  146, harap pertimbangkan

                  Pengecualian dilemparkan ketika penurunan kunci gagal, jika tidak, kunci turunan dikembalikan sebagai

                  import { createReadStream } from 'node:fs';
                  import { stdout } from 'node:process';
                  const {
                    createHmac,
                  } = await import('node:crypto');
                  
                  const hmac = createHmac('sha256', 'a secret');
                  
                  const input = createReadStream('test.js');
                  input.pipe(hmac).pipe(stdout);const {
                    createReadStream,
                  } = require('node:fs');
                  const {
                    createHmac,
                  } = require('node:crypto');
                  const { stdout } = require('node:process');
                  
                  const hmac = createHmac('sha256', 'a secret');
                  
                  const input = createReadStream('test.js');
                  input.pipe(hmac).pipe(stdout);
                  3

                  Pengecualian dilemparkan ketika salah satu argumen input menentukan nilai atau tipe yang tidak valid

                  let crypto;
                  try {
                    crypto = await import('node:crypto');
                  } catch (err) {
                    console.error('crypto support is disabled!');
                  }
                  _365

                  • Returns.
                    • let crypto;
                      try {
                        crypto = await import('node:crypto');
                      } catch (err) {
                        console.error('crypto support is disabled!');
                      }
                      366 Total ukuran tumpukan aman yang dialokasikan seperti yang ditentukan menggunakan flag baris perintah
                      let crypto;
                      try {
                        crypto = await import('node:crypto');
                      } catch (err) {
                        console.error('crypto support is disabled!');
                      }
                      367
                    • let crypto;
                      try {
                        crypto = await import('node:crypto');
                      } catch (err) {
                        console.error('crypto support is disabled!');
                      }
                      328 Alokasi minimum dari tumpukan aman seperti yang ditentukan menggunakan bendera baris perintah
                      let crypto;
                      try {
                        crypto = await import('node:crypto');
                      } catch (err) {
                        console.error('crypto support is disabled!');
                      }
                      369
                    • let crypto;
                      try {
                        crypto = await import('node:crypto');
                      } catch (err) {
                        console.error('crypto support is disabled!');
                      }
                      370 Jumlah total byte yang saat ini dialokasikan dari tumpukan aman
                    • let crypto;
                      try {
                        crypto = await import('node:crypto');
                      } catch (err) {
                        console.error('crypto support is disabled!');
                      }
                      371 Rasio yang dihitung dari
                      let crypto;
                      try {
                        crypto = await import('node:crypto');
                      } catch (err) {
                        console.error('crypto support is disabled!');
                      }
                      370 hingga
                      let crypto;
                      try {
                        crypto = await import('node:crypto');
                      } catch (err) {
                        console.error('crypto support is disabled!');
                      }
                      366 byte yang dialokasikan

                    let crypto;
                    try {
                      crypto = await import('node:crypto');
                    } catch (err) {
                      console.error('crypto support is disabled!');
                    }
                    _374

                    Muat dan atur

                    let crypto;
                    try {
                      crypto = await import('node:crypto');
                    } catch (err) {
                      console.error('crypto support is disabled!');
                    }
                    375 untuk beberapa atau semua fungsi OpenSSL (dipilih oleh bendera)

                    let crypto;
                    try {
                      crypto = await import('node:crypto');
                    } catch (err) {
                      console.error('crypto support is disabled!');
                    }
                    375 bisa berupa id atau jalur ke pustaka bersama mesin

                    Argumen

                    let crypto;
                    try {
                      crypto = await import('node:crypto');
                    } catch (err) {
                      console.error('crypto support is disabled!');
                    }
                    _377 opsional menggunakan ________0______378 secara default.
                    let crypto;
                    try {
                      crypto = await import('node:crypto');
                    } catch (err) {
                      console.error('crypto support is disabled!');
                    }
                    377 adalah bidang bit yang mengambil salah satu atau campuran dari bendera berikut (didefinisikan dalam
                    const { X509Certificate } = await import('node:crypto');
                    
                    const x509 = new X509Certificate('{.. pem encoded cert ...}');
                    
                    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
                    
                    const x509 = new X509Certificate('{.. pem encoded cert ...}');
                    
                    console.log(x509.subject);
                    73)

                    • let crypto;
                      try {
                        crypto = await import('node:crypto');
                      } catch (err) {
                        console.error('crypto support is disabled!');
                      }
                      _381
                    • let crypto;
                      try {
                        crypto = await import('node:crypto');
                      } catch (err) {
                        console.error('crypto support is disabled!');
                      }
                      _382
                    • let crypto;
                      try {
                        crypto = await import('node:crypto');
                      } catch (err) {
                        console.error('crypto support is disabled!');
                      }
                      _383
                    • let crypto;
                      try {
                        crypto = await import('node:crypto');
                      } catch (err) {
                        console.error('crypto support is disabled!');
                      }
                      _384
                    • let crypto;
                      try {
                        crypto = await import('node:crypto');
                      } catch (err) {
                        console.error('crypto support is disabled!');
                      }
                      _385
                    • let crypto;
                      try {
                        crypto = await import('node:crypto');
                      } catch (err) {
                        console.error('crypto support is disabled!');
                      }
                      _386
                    • let crypto;
                      try {
                        crypto = await import('node:crypto');
                      } catch (err) {
                        console.error('crypto support is disabled!');
                      }
                      _387
                    • let crypto;
                      try {
                        crypto = await import('node:crypto');
                      } catch (err) {
                        console.error('crypto support is disabled!');
                      }
                      _388
                    • let crypto;
                      try {
                        crypto = await import('node:crypto');
                      } catch (err) {
                        console.error('crypto support is disabled!');
                      }
                      _389
                    • let crypto;
                      try {
                        crypto = await import('node:crypto');
                      } catch (err) {
                        console.error('crypto support is disabled!');
                      }
                      _390
                    • let crypto;
                      try {
                        crypto = await import('node:crypto');
                      } catch (err) {
                        console.error('crypto support is disabled!');
                      }
                      _391

                    let crypto;
                    try {
                      crypto = await import('node:crypto');
                    } catch (err) {
                      console.error('crypto support is disabled!');
                    }
                    _392

                    Mengaktifkan penyedia kripto yang sesuai dengan FIPS di Node yang mendukung FIPS. jsbuild. Melempar kesalahan jika mode FIPS tidak tersedia

                    let crypto;
                    try {
                      crypto = await import('node:crypto');
                    } catch (err) {
                      console.error('crypto support is disabled!');
                    }
                    _393

                    HistoryVersionChangesv18. 0. 0

                    Melewati panggilan balik yang tidak valid ke argumen

                    const { X509Certificate } = await import('node:crypto');
                    
                    const x509 = new X509Certificate('{.. pem encoded cert ...}');
                    
                    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
                    
                    const x509 = new X509Certificate('{.. pem encoded cert ...}');
                    
                    console.log(x509.subject);
                    84 sekarang melempar
                    const { X509Certificate } = await import('node:crypto');
                    
                    const x509 = new X509Certificate('{.. pem encoded cert ...}');
                    
                    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
                    
                    const x509 = new X509Certificate('{.. pem encoded cert ...}');
                    
                    console.log(x509.subject);
                    85 alih-alih
                    const { X509Certificate } = await import('node:crypto');
                    
                    const x509 = new X509Certificate('{.. pem encoded cert ...}');
                    
                    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
                    
                    const x509 = new X509Certificate('{.. pem encoded cert ...}');
                    
                    console.log(x509.subject);
                    86

                    v15. 12. 0

                    Argumen callback opsional ditambahkan

                    v13. 2. 0, v12. 16. 0

                    This function now supports IEEE-P1363 DSA and ECDSA signatures

                    v12. 0. 0

                    ditambahkan. v12. 0. 0

                    Menghitung dan mengembalikan tanda tangan untuk

                    import { Buffer } from 'node:buffer';
                    const { randomFill } = await import('node:crypto');
                    
                    const a = new Uint32Array(10);
                    randomFill(a, (err, buf) => {
                      if (err) throw err;
                      console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                        .toString('hex'));
                    });
                    
                    const b = new DataView(new ArrayBuffer(10));
                    randomFill(b, (err, buf) => {
                      if (err) throw err;
                      console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                        .toString('hex'));
                    });
                    
                    const c = new ArrayBuffer(10);
                    randomFill(c, (err, buf) => {
                      if (err) throw err;
                      console.log(Buffer.from(buf).toString('hex'));
                    });const { randomFill } = require('node:crypto');
                    const { Buffer } = require('node:buffer');
                    
                    const a = new Uint32Array(10);
                    randomFill(a, (err, buf) => {
                      if (err) throw err;
                      console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                        .toString('hex'));
                    });
                    
                    const b = new DataView(new ArrayBuffer(10));
                    randomFill(b, (err, buf) => {
                      if (err) throw err;
                      console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                        .toString('hex'));
                    });
                    
                    const c = new ArrayBuffer(10);
                    randomFill(c, (err, buf) => {
                      if (err) throw err;
                      console.log(Buffer.from(buf).toString('hex'));
                    });
                    5 menggunakan kunci pribadi dan algoritme yang diberikan. Jika
                    const {
                      generateKeyPairSync,
                    } = await import('node:crypto');
                    
                    const {
                      publicKey,
                      privateKey,
                    } = generateKeyPairSync('rsa', {
                      modulusLength: 4096,
                      publicKeyEncoding: {
                        type: 'spki',
                        format: 'pem',
                      },
                      privateKeyEncoding: {
                        type: 'pkcs8',
                        format: 'pem',
                        cipher: 'aes-256-cbc',
                        passphrase: 'top secret',
                      },
                    });const {
                      generateKeyPairSync,
                    } = require('node:crypto');
                    
                    const {
                      publicKey,
                      privateKey,
                    } = generateKeyPairSync('rsa', {
                      modulusLength: 4096,
                      publicKeyEncoding: {
                        type: 'spki',
                        format: 'pem',
                      },
                      privateKeyEncoding: {
                        type: 'pkcs8',
                        format: 'pem',
                        cipher: 'aes-256-cbc',
                        passphrase: 'top secret',
                      },
                    });
                    _16 adalah
                    const {
                      generateKeyPairSync,
                    } = await import('node:crypto');
                    
                    const {
                      publicKey,
                      privateKey,
                    } = generateKeyPairSync('rsa', {
                      modulusLength: 4096,
                      publicKeyEncoding: {
                        type: 'spki',
                        format: 'pem',
                      },
                      privateKeyEncoding: {
                        type: 'pkcs8',
                        format: 'pem',
                        cipher: 'aes-256-cbc',
                        passphrase: 'top secret',
                      },
                    });const {
                      generateKeyPairSync,
                    } = require('node:crypto');
                    
                    const {
                      publicKey,
                      privateKey,
                    } = generateKeyPairSync('rsa', {
                      modulusLength: 4096,
                      publicKeyEncoding: {
                        type: 'spki',
                        format: 'pem',
                      },
                      privateKeyEncoding: {
                        type: 'pkcs8',
                        format: 'pem',
                        cipher: 'aes-256-cbc',
                        passphrase: 'top secret',
                      },
                    });
                    48 atau
                    import { createReadStream } from 'node:fs';
                    import { stdout } from 'node:process';
                    const { createHash } = await import('node:crypto');
                    
                    const hash = createHash('sha256');
                    
                    const input = createReadStream('test.js');
                    input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
                    const { createHash } = require('node:crypto');
                    const { stdout } = require('node:process');
                    
                    const hash = createHash('sha256');
                    
                    const input = createReadStream('test.js');
                    input.pipe(hash).setEncoding('hex').pipe(stdout);
                    50, maka algoritme bergantung pada jenis kunci (terutama Ed25519 dan Ed448)

                    Jika

                    const { Certificate } = await import('node:crypto');
                    
                    const cert1 = new Certificate();
                    const cert2 = Certificate();const { Certificate } = require('node:crypto');
                    
                    const cert1 = new Certificate();
                    const cert2 = Certificate();
                    _63 bukan a , fungsi ini berperilaku seolah-olah
                    const { Certificate } = await import('node:crypto');
                    
                    const cert1 = new Certificate();
                    const cert2 = Certificate();const { Certificate } = require('node:crypto');
                    
                    const cert1 = new Certificate();
                    const cert2 = Certificate();
                    63 telah diteruskan ke. Jika itu adalah objek, properti tambahan berikut dapat diteruskan

                    • import { createReadStream } from 'node:fs';
                      import { stdout } from 'node:process';
                      const {
                        createHmac,
                      } = await import('node:crypto');
                      
                      const hmac = createHmac('sha256', 'a secret');
                      
                      const input = createReadStream('test.js');
                      input.pipe(hmac).pipe(stdout);const {
                        createReadStream,
                      } = require('node:fs');
                      const {
                        createHmac,
                      } = require('node:crypto');
                      const { stdout } = require('node:process');
                      
                      const hmac = createHmac('sha256', 'a secret');
                      
                      const input = createReadStream('test.js');
                      input.pipe(hmac).pipe(stdout);
                      25 For DSA and ECDSA, this option specifies the format of the generated signature. It can be one of the following

                      • import { createReadStream } from 'node:fs';
                        import { stdout } from 'node:process';
                        const { createHash } = await import('node:crypto');
                        
                        const hash = createHash('sha256');
                        
                        const input = createReadStream('test.js');
                        input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
                        const { createHash } = require('node:crypto');
                        const { stdout } = require('node:process');
                        
                        const hash = createHash('sha256');
                        
                        const input = createReadStream('test.js');
                        input.pipe(hash).setEncoding('hex').pipe(stdout);
                        76 (default). DER-encoded ASN. 1 signature structure encoding
                        import { createReadStream } from 'node:fs';
                        import { stdout } from 'node:process';
                        const {
                          createHmac,
                        } = await import('node:crypto');
                        
                        const hmac = createHmac('sha256', 'a secret');
                        
                        const input = createReadStream('test.js');
                        input.pipe(hmac).pipe(stdout);const {
                          createReadStream,
                        } = require('node:fs');
                        const {
                          createHmac,
                        } = require('node:crypto');
                        const { stdout } = require('node:process');
                        
                        const hmac = createHmac('sha256', 'a secret');
                        
                        const input = createReadStream('test.js');
                        input.pipe(hmac).pipe(stdout);
                        27
                      • import { createReadStream } from 'node:fs';
                        import { stdout } from 'node:process';
                        const {
                          createHmac,
                        } = await import('node:crypto');
                        
                        const hmac = createHmac('sha256', 'a secret');
                        
                        const input = createReadStream('test.js');
                        input.pipe(hmac).pipe(stdout);const {
                          createReadStream,
                        } = require('node:fs');
                        const {
                          createHmac,
                        } = require('node:crypto');
                        const { stdout } = require('node:process');
                        
                        const hmac = createHmac('sha256', 'a secret');
                        
                        const input = createReadStream('test.js');
                        input.pipe(hmac).pipe(stdout);
                        28. Signature format
                        import { createReadStream } from 'node:fs';
                        import { stdout } from 'node:process';
                        const {
                          createHmac,
                        } = await import('node:crypto');
                        
                        const hmac = createHmac('sha256', 'a secret');
                        
                        const input = createReadStream('test.js');
                        input.pipe(hmac).pipe(stdout);const {
                          createReadStream,
                        } = require('node:fs');
                        const {
                          createHmac,
                        } = require('node:crypto');
                        const { stdout } = require('node:process');
                        
                        const hmac = createHmac('sha256', 'a secret');
                        
                        const input = createReadStream('test.js');
                        input.pipe(hmac).pipe(stdout);
                        29 as proposed in IEEE-P1363
                    • import { createReadStream } from 'node:fs';
                      import { stdout } from 'node:process';
                      const {
                        createHmac,
                      } = await import('node:crypto');
                      
                      const hmac = createHmac('sha256', 'a secret');
                      
                      const input = createReadStream('test.js');
                      input.pipe(hmac).pipe(stdout);const {
                        createReadStream,
                      } = require('node:fs');
                      const {
                        createHmac,
                      } = require('node:crypto');
                      const { stdout } = require('node:process');
                      
                      const hmac = createHmac('sha256', 'a secret');
                      
                      const input = createReadStream('test.js');
                      input.pipe(hmac).pipe(stdout);
                      30 Optional padding value for RSA, one of the following

                      • import { createReadStream } from 'node:fs';
                        import { stdout } from 'node:process';
                        const {
                          createHmac,
                        } = await import('node:crypto');
                        
                        const hmac = createHmac('sha256', 'a secret');
                        
                        const input = createReadStream('test.js');
                        input.pipe(hmac).pipe(stdout);const {
                          createReadStream,
                        } = require('node:fs');
                        const {
                          createHmac,
                        } = require('node:crypto');
                        const { stdout } = require('node:process');
                        
                        const hmac = createHmac('sha256', 'a secret');
                        
                        const input = createReadStream('test.js');
                        input.pipe(hmac).pipe(stdout);
                        31 (default)
                      • import { createReadStream } from 'node:fs';
                        import { stdout } from 'node:process';
                        const {
                          createHmac,
                        } = await import('node:crypto');
                        
                        const hmac = createHmac('sha256', 'a secret');
                        
                        const input = createReadStream('test.js');
                        input.pipe(hmac).pipe(stdout);const {
                          createReadStream,
                        } = require('node:fs');
                        const {
                          createHmac,
                        } = require('node:crypto');
                        const { stdout } = require('node:process');
                        
                        const hmac = createHmac('sha256', 'a secret');
                        
                        const input = createReadStream('test.js');
                        input.pipe(hmac).pipe(stdout);
                        32

                      import { createReadStream } from 'node:fs';
                      import { stdout } from 'node:process';
                      const {
                        createHmac,
                      } = await import('node:crypto');
                      
                      const hmac = createHmac('sha256', 'a secret');
                      
                      const input = createReadStream('test.js');
                      input.pipe(hmac).pipe(stdout);const {
                        createReadStream,
                      } = require('node:fs');
                      const {
                        createHmac,
                      } = require('node:crypto');
                      const { stdout } = require('node:process');
                      
                      const hmac = createHmac('sha256', 'a secret');
                      
                      const input = createReadStream('test.js');
                      input.pipe(hmac).pipe(stdout);
                      _33 akan menggunakan MGF1 dengan fungsi hash yang sama yang digunakan untuk menandatangani pesan seperti yang ditentukan di bagian 3. 1 dari RFC 4055

                    • import { createReadStream } from 'node:fs';
                      import { stdout } from 'node:process';
                      const { createHash } = await import('node:crypto');
                      
                      const hash = createHash('sha256');
                      
                      const input = createReadStream('test.js');
                      input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
                      const { createHash } = require('node:crypto');
                      const { stdout } = require('node:process');
                      
                      const hash = createHash('sha256');
                      
                      const input = createReadStream('test.js');
                      input.pipe(hash).setEncoding('hex').pipe(stdout);
                      39 Salt length for when padding is
                      import { createReadStream } from 'node:fs';
                      import { stdout } from 'node:process';
                      const {
                        createHmac,
                      } = await import('node:crypto');
                      
                      const hmac = createHmac('sha256', 'a secret');
                      
                      const input = createReadStream('test.js');
                      input.pipe(hmac).pipe(stdout);const {
                        createReadStream,
                      } = require('node:fs');
                      const {
                        createHmac,
                      } = require('node:crypto');
                      const { stdout } = require('node:process');
                      
                      const hmac = createHmac('sha256', 'a secret');
                      
                      const input = createReadStream('test.js');
                      input.pipe(hmac).pipe(stdout);
                      33. The special value
                      import { createReadStream } from 'node:fs';
                      import { stdout } from 'node:process';
                      const {
                        createHmac,
                      } = await import('node:crypto');
                      
                      const hmac = createHmac('sha256', 'a secret');
                      
                      const input = createReadStream('test.js');
                      input.pipe(hmac).pipe(stdout);const {
                        createReadStream,
                      } = require('node:fs');
                      const {
                        createHmac,
                      } = require('node:crypto');
                      const { stdout } = require('node:process');
                      
                      const hmac = createHmac('sha256', 'a secret');
                      
                      const input = createReadStream('test.js');
                      input.pipe(hmac).pipe(stdout);
                      36 sets the salt length to the digest size,
                      import { createReadStream } from 'node:fs';
                      import { stdout } from 'node:process';
                      const {
                        createHmac,
                      } = await import('node:crypto');
                      
                      const hmac = createHmac('sha256', 'a secret');
                      
                      const input = createReadStream('test.js');
                      input.pipe(hmac).pipe(stdout);const {
                        createReadStream,
                      } = require('node:fs');
                      const {
                        createHmac,
                      } = require('node:crypto');
                      const { stdout } = require('node:process');
                      
                      const hmac = createHmac('sha256', 'a secret');
                      
                      const input = createReadStream('test.js');
                      input.pipe(hmac).pipe(stdout);
                      37 (default) sets it to the maximum permissible value

                    Jika fungsi

                    const { X509Certificate } = await import('node:crypto');
                    
                    const x509 = new X509Certificate('{.. pem encoded cert ...}');
                    
                    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
                    
                    const x509 = new X509Certificate('{.. pem encoded cert ...}');
                    
                    console.log(x509.subject);
                    _84 disediakan, fungsi ini menggunakan threadpool libuv

                    let crypto;
                    try {
                      crypto = await import('node:crypto');
                    } catch (err) {
                      console.error('crypto support is disabled!');
                    }
                    _419

                    Alias ​​​​yang nyaman untuk

                    let crypto;
                    try {
                      crypto = await import('node:crypto');
                    } catch (err) {
                      console.error('crypto support is disabled!');
                    }
                    _421

                    HistoryVersionChangesv15. 0. 0

                    Argumen a dan b juga bisa berupa ArrayBuffer

                    v6. 6. 0

                    ditambahkan. v6. 6. 0

                    Fungsi ini membandingkan byte dasar yang mewakili instance

                    let crypto;
                    try {
                      crypto = await import('node:crypto');
                    } catch (err) {
                      console.error('crypto support is disabled!');
                    }
                    061,
                    let crypto;
                    try {
                      crypto = await import('node:crypto');
                    } catch (err) {
                      console.error('crypto support is disabled!');
                    }
                    01, atau
                    let crypto;
                    try {
                      crypto = await import('node:crypto');
                    } catch (err) {
                      console.error('crypto support is disabled!');
                    }
                    02 yang diberikan menggunakan algoritme waktu konstan

                    Fungsi ini tidak membocorkan informasi waktu yang memungkinkan penyerang menebak salah satu nilai. Ini cocok untuk membandingkan intisari HMAC atau nilai rahasia seperti cookie autentikasi atau url kemampuan

                    let crypto;
                    try {
                      crypto = await import('node:crypto');
                    } catch (err) {
                      console.error('crypto support is disabled!');
                    }
                    425 dan
                    let crypto;
                    try {
                      crypto = await import('node:crypto');
                    } catch (err) {
                      console.error('crypto support is disabled!');
                    }
                    426 keduanya harus
                    import { createReadStream } from 'node:fs';
                    import { stdout } from 'node:process';
                    const {
                      createHmac,
                    } = await import('node:crypto');
                    
                    const hmac = createHmac('sha256', 'a secret');
                    
                    const input = createReadStream('test.js');
                    input.pipe(hmac).pipe(stdout);const {
                      createReadStream,
                    } = require('node:fs');
                    const {
                      createHmac,
                    } = require('node:crypto');
                    const { stdout } = require('node:process');
                    
                    const hmac = createHmac('sha256', 'a secret');
                    
                    const input = createReadStream('test.js');
                    input.pipe(hmac).pipe(stdout);
                    3s,
                    let crypto;
                    try {
                      crypto = await import('node:crypto');
                    } catch (err) {
                      console.error('crypto support is disabled!');
                    }
                    01s, atau
                    let crypto;
                    try {
                      crypto = await import('node:crypto');
                    } catch (err) {
                      console.error('crypto support is disabled!');
                    }
                    02s, dan keduanya harus memiliki panjang byte yang sama. Kesalahan dilemparkan jika
                    let crypto;
                    try {
                      crypto = await import('node:crypto');
                    } catch (err) {
                      console.error('crypto support is disabled!');
                    }
                    425 dan
                    let crypto;
                    try {
                      crypto = await import('node:crypto');
                    } catch (err) {
                      console.error('crypto support is disabled!');
                    }
                    426 memiliki panjang byte yang berbeda

                    Jika setidaknya salah satu dari

                    let crypto;
                    try {
                      crypto = await import('node:crypto');
                    } catch (err) {
                      console.error('crypto support is disabled!');
                    }
                    425 dan
                    let crypto;
                    try {
                      crypto = await import('node:crypto');
                    } catch (err) {
                      console.error('crypto support is disabled!');
                    }
                    426 adalah
                    let crypto;
                    try {
                      crypto = await import('node:crypto');
                    } catch (err) {
                      console.error('crypto support is disabled!');
                    }
                    01 dengan lebih dari satu byte per entri, seperti
                    let crypto;
                    try {
                      crypto = await import('node:crypto');
                    } catch (err) {
                      console.error('crypto support is disabled!');
                    }
                    435, hasilnya akan dihitung menggunakan urutan byte platform

                    Ketika kedua input adalah

                    let crypto;
                    try {
                      crypto = await import('node:crypto');
                    } catch (err) {
                      console.error('crypto support is disabled!');
                    }
                    _313s atau
                    let crypto;
                    try {
                      crypto = await import('node:crypto');
                    } catch (err) {
                      console.error('crypto support is disabled!');
                    }
                    314s, fungsi ini mungkin mengembalikan hasil yang tidak terduga karena pengkodean IEEE 754 dari angka titik-mengambang. Secara khusus, baik
                    let crypto;
                    try {
                      crypto = await import('node:crypto');
                    } catch (err) {
                      console.error('crypto support is disabled!');
                    }
                    438 maupun
                    let crypto;
                    try {
                      crypto = await import('node:crypto');
                    } catch (err) {
                      console.error('crypto support is disabled!');
                    }
                    439 tidak menyiratkan bahwa representasi byte dari dua angka floating-point
                    let crypto;
                    try {
                      crypto = await import('node:crypto');
                    } catch (err) {
                      console.error('crypto support is disabled!');
                    }
                    440 dan
                    let crypto;
                    try {
                      crypto = await import('node:crypto');
                    } catch (err) {
                      console.error('crypto support is disabled!');
                    }
                    441 adalah sama

                    Penggunaan

                    let crypto;
                    try {
                      crypto = await import('node:crypto');
                    } catch (err) {
                      console.error('crypto support is disabled!');
                    }
                    _442 tidak menjamin bahwa kode sekitarnya aman untuk waktu. Perawatan harus diambil untuk memastikan bahwa kode di sekitarnya tidak menimbulkan kerentanan waktu

                    let crypto;
                    try {
                      crypto = await import('node:crypto');
                    } catch (err) {
                      console.error('crypto support is disabled!');
                    }
                    443

                    HistoryVersionChangesv18. 0. 0

                    Melewati panggilan balik yang tidak valid ke argumen

                    const { X509Certificate } = await import('node:crypto');
                    
                    const x509 = new X509Certificate('{.. pem encoded cert ...}');
                    
                    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
                    
                    const x509 = new X509Certificate('{.. pem encoded cert ...}');
                    
                    console.log(x509.subject);
                    84 sekarang melempar
                    const { X509Certificate } = await import('node:crypto');
                    
                    const x509 = new X509Certificate('{.. pem encoded cert ...}');
                    
                    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
                    
                    const x509 = new X509Certificate('{.. pem encoded cert ...}');
                    
                    console.log(x509.subject);
                    85 alih-alih
                    const { X509Certificate } = await import('node:crypto');
                    
                    const x509 = new X509Certificate('{.. pem encoded cert ...}');
                    
                    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
                    
                    const x509 = new X509Certificate('{.. pem encoded cert ...}');
                    
                    console.log(x509.subject);
                    86

                    v15. 12. 0

                    Argumen callback opsional ditambahkan

                    v15. 0. 0

                    Argumen data, kunci, dan tanda tangan juga bisa berupa ArrayBuffer

                    v13. 2. 0, v12. 16. 0

                    This function now supports IEEE-P1363 DSA and ECDSA signatures

                    v12. 0. 0

                    ditambahkan. v12. 0. 0

                    Memverifikasi tanda tangan yang diberikan untuk

                    import { Buffer } from 'node:buffer';
                    const { randomFill } = await import('node:crypto');
                    
                    const a = new Uint32Array(10);
                    randomFill(a, (err, buf) => {
                      if (err) throw err;
                      console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                        .toString('hex'));
                    });
                    
                    const b = new DataView(new ArrayBuffer(10));
                    randomFill(b, (err, buf) => {
                      if (err) throw err;
                      console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                        .toString('hex'));
                    });
                    
                    const c = new ArrayBuffer(10);
                    randomFill(c, (err, buf) => {
                      if (err) throw err;
                      console.log(Buffer.from(buf).toString('hex'));
                    });const { randomFill } = require('node:crypto');
                    const { Buffer } = require('node:buffer');
                    
                    const a = new Uint32Array(10);
                    randomFill(a, (err, buf) => {
                      if (err) throw err;
                      console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                        .toString('hex'));
                    });
                    
                    const b = new DataView(new ArrayBuffer(10));
                    randomFill(b, (err, buf) => {
                      if (err) throw err;
                      console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                        .toString('hex'));
                    });
                    
                    const c = new ArrayBuffer(10);
                    randomFill(c, (err, buf) => {
                      if (err) throw err;
                      console.log(Buffer.from(buf).toString('hex'));
                    });
                    _5 menggunakan kunci dan algoritme yang diberikan. Jika
                    const {
                      generateKeyPairSync,
                    } = await import('node:crypto');
                    
                    const {
                      publicKey,
                      privateKey,
                    } = generateKeyPairSync('rsa', {
                      modulusLength: 4096,
                      publicKeyEncoding: {
                        type: 'spki',
                        format: 'pem',
                      },
                      privateKeyEncoding: {
                        type: 'pkcs8',
                        format: 'pem',
                        cipher: 'aes-256-cbc',
                        passphrase: 'top secret',
                      },
                    });const {
                      generateKeyPairSync,
                    } = require('node:crypto');
                    
                    const {
                      publicKey,
                      privateKey,
                    } = generateKeyPairSync('rsa', {
                      modulusLength: 4096,
                      publicKeyEncoding: {
                        type: 'spki',
                        format: 'pem',
                      },
                      privateKeyEncoding: {
                        type: 'pkcs8',
                        format: 'pem',
                        cipher: 'aes-256-cbc',
                        passphrase: 'top secret',
                      },
                    });
                    _16 adalah
                    const {
                      generateKeyPairSync,
                    } = await import('node:crypto');
                    
                    const {
                      publicKey,
                      privateKey,
                    } = generateKeyPairSync('rsa', {
                      modulusLength: 4096,
                      publicKeyEncoding: {
                        type: 'spki',
                        format: 'pem',
                      },
                      privateKeyEncoding: {
                        type: 'pkcs8',
                        format: 'pem',
                        cipher: 'aes-256-cbc',
                        passphrase: 'top secret',
                      },
                    });const {
                      generateKeyPairSync,
                    } = require('node:crypto');
                    
                    const {
                      publicKey,
                      privateKey,
                    } = generateKeyPairSync('rsa', {
                      modulusLength: 4096,
                      publicKeyEncoding: {
                        type: 'spki',
                        format: 'pem',
                      },
                      privateKeyEncoding: {
                        type: 'pkcs8',
                        format: 'pem',
                        cipher: 'aes-256-cbc',
                        passphrase: 'top secret',
                      },
                    });
                    48 atau
                    import { createReadStream } from 'node:fs';
                    import { stdout } from 'node:process';
                    const { createHash } = await import('node:crypto');
                    
                    const hash = createHash('sha256');
                    
                    const input = createReadStream('test.js');
                    input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
                    const { createHash } = require('node:crypto');
                    const { stdout } = require('node:process');
                    
                    const hash = createHash('sha256');
                    
                    const input = createReadStream('test.js');
                    input.pipe(hash).setEncoding('hex').pipe(stdout);
                    50, maka algoritme bergantung pada jenis kunci (terutama Ed25519 dan Ed448)

                    Jika

                    const { Certificate } = await import('node:crypto');
                    
                    const cert1 = new Certificate();
                    const cert2 = Certificate();const { Certificate } = require('node:crypto');
                    
                    const cert1 = new Certificate();
                    const cert2 = Certificate();
                    _63 bukan a , fungsi ini berperilaku seolah-olah
                    const { Certificate } = await import('node:crypto');
                    
                    const cert1 = new Certificate();
                    const cert2 = Certificate();const { Certificate } = require('node:crypto');
                    
                    const cert1 = new Certificate();
                    const cert2 = Certificate();
                    63 telah diteruskan ke. Jika itu adalah objek, properti tambahan berikut dapat diteruskan

                    • import { createReadStream } from 'node:fs';
                      import { stdout } from 'node:process';
                      const {
                        createHmac,
                      } = await import('node:crypto');
                      
                      const hmac = createHmac('sha256', 'a secret');
                      
                      const input = createReadStream('test.js');
                      input.pipe(hmac).pipe(stdout);const {
                        createReadStream,
                      } = require('node:fs');
                      const {
                        createHmac,
                      } = require('node:crypto');
                      const { stdout } = require('node:process');
                      
                      const hmac = createHmac('sha256', 'a secret');
                      
                      const input = createReadStream('test.js');
                      input.pipe(hmac).pipe(stdout);
                      25 For DSA and ECDSA, this option specifies the format of the signature. It can be one of the following

                      • import { createReadStream } from 'node:fs';
                        import { stdout } from 'node:process';
                        const { createHash } = await import('node:crypto');
                        
                        const hash = createHash('sha256');
                        
                        const input = createReadStream('test.js');
                        input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
                        const { createHash } = require('node:crypto');
                        const { stdout } = require('node:process');
                        
                        const hash = createHash('sha256');
                        
                        const input = createReadStream('test.js');
                        input.pipe(hash).setEncoding('hex').pipe(stdout);
                        76 (default). DER-encoded ASN. 1 signature structure encoding
                        import { createReadStream } from 'node:fs';
                        import { stdout } from 'node:process';
                        const {
                          createHmac,
                        } = await import('node:crypto');
                        
                        const hmac = createHmac('sha256', 'a secret');
                        
                        const input = createReadStream('test.js');
                        input.pipe(hmac).pipe(stdout);const {
                          createReadStream,
                        } = require('node:fs');
                        const {
                          createHmac,
                        } = require('node:crypto');
                        const { stdout } = require('node:process');
                        
                        const hmac = createHmac('sha256', 'a secret');
                        
                        const input = createReadStream('test.js');
                        input.pipe(hmac).pipe(stdout);
                        27
                      • import { createReadStream } from 'node:fs';
                        import { stdout } from 'node:process';
                        const {
                          createHmac,
                        } = await import('node:crypto');
                        
                        const hmac = createHmac('sha256', 'a secret');
                        
                        const input = createReadStream('test.js');
                        input.pipe(hmac).pipe(stdout);const {
                          createReadStream,
                        } = require('node:fs');
                        const {
                          createHmac,
                        } = require('node:crypto');
                        const { stdout } = require('node:process');
                        
                        const hmac = createHmac('sha256', 'a secret');
                        
                        const input = createReadStream('test.js');
                        input.pipe(hmac).pipe(stdout);
                        28. Signature format
                        import { createReadStream } from 'node:fs';
                        import { stdout } from 'node:process';
                        const {
                          createHmac,
                        } = await import('node:crypto');
                        
                        const hmac = createHmac('sha256', 'a secret');
                        
                        const input = createReadStream('test.js');
                        input.pipe(hmac).pipe(stdout);const {
                          createReadStream,
                        } = require('node:fs');
                        const {
                          createHmac,
                        } = require('node:crypto');
                        const { stdout } = require('node:process');
                        
                        const hmac = createHmac('sha256', 'a secret');
                        
                        const input = createReadStream('test.js');
                        input.pipe(hmac).pipe(stdout);
                        29 as proposed in IEEE-P1363
                    • import { createReadStream } from 'node:fs';
                      import { stdout } from 'node:process';
                      const {
                        createHmac,
                      } = await import('node:crypto');
                      
                      const hmac = createHmac('sha256', 'a secret');
                      
                      const input = createReadStream('test.js');
                      input.pipe(hmac).pipe(stdout);const {
                        createReadStream,
                      } = require('node:fs');
                      const {
                        createHmac,
                      } = require('node:crypto');
                      const { stdout } = require('node:process');
                      
                      const hmac = createHmac('sha256', 'a secret');
                      
                      const input = createReadStream('test.js');
                      input.pipe(hmac).pipe(stdout);
                      30 Optional padding value for RSA, one of the following

                      • import { createReadStream } from 'node:fs';
                        import { stdout } from 'node:process';
                        const {
                          createHmac,
                        } = await import('node:crypto');
                        
                        const hmac = createHmac('sha256', 'a secret');
                        
                        const input = createReadStream('test.js');
                        input.pipe(hmac).pipe(stdout);const {
                          createReadStream,
                        } = require('node:fs');
                        const {
                          createHmac,
                        } = require('node:crypto');
                        const { stdout } = require('node:process');
                        
                        const hmac = createHmac('sha256', 'a secret');
                        
                        const input = createReadStream('test.js');
                        input.pipe(hmac).pipe(stdout);
                        31 (default)
                      • import { createReadStream } from 'node:fs';
                        import { stdout } from 'node:process';
                        const {
                          createHmac,
                        } = await import('node:crypto');
                        
                        const hmac = createHmac('sha256', 'a secret');
                        
                        const input = createReadStream('test.js');
                        input.pipe(hmac).pipe(stdout);const {
                          createReadStream,
                        } = require('node:fs');
                        const {
                          createHmac,
                        } = require('node:crypto');
                        const { stdout } = require('node:process');
                        
                        const hmac = createHmac('sha256', 'a secret');
                        
                        const input = createReadStream('test.js');
                        input.pipe(hmac).pipe(stdout);
                        32

                      import { createReadStream } from 'node:fs';
                      import { stdout } from 'node:process';
                      const {
                        createHmac,
                      } = await import('node:crypto');
                      
                      const hmac = createHmac('sha256', 'a secret');
                      
                      const input = createReadStream('test.js');
                      input.pipe(hmac).pipe(stdout);const {
                        createReadStream,
                      } = require('node:fs');
                      const {
                        createHmac,
                      } = require('node:crypto');
                      const { stdout } = require('node:process');
                      
                      const hmac = createHmac('sha256', 'a secret');
                      
                      const input = createReadStream('test.js');
                      input.pipe(hmac).pipe(stdout);
                      _33 akan menggunakan MGF1 dengan fungsi hash yang sama yang digunakan untuk menandatangani pesan seperti yang ditentukan di bagian 3. 1 dari RFC 4055

                    • import { createReadStream } from 'node:fs';
                      import { stdout } from 'node:process';
                      const { createHash } = await import('node:crypto');
                      
                      const hash = createHash('sha256');
                      
                      const input = createReadStream('test.js');
                      input.pipe(hash).setEncoding('hex').pipe(stdout);const { createReadStream } = require('node:fs');
                      const { createHash } = require('node:crypto');
                      const { stdout } = require('node:process');
                      
                      const hash = createHash('sha256');
                      
                      const input = createReadStream('test.js');
                      input.pipe(hash).setEncoding('hex').pipe(stdout);
                      39 Salt length for when padding is
                      import { createReadStream } from 'node:fs';
                      import { stdout } from 'node:process';
                      const {
                        createHmac,
                      } = await import('node:crypto');
                      
                      const hmac = createHmac('sha256', 'a secret');
                      
                      const input = createReadStream('test.js');
                      input.pipe(hmac).pipe(stdout);const {
                        createReadStream,
                      } = require('node:fs');
                      const {
                        createHmac,
                      } = require('node:crypto');
                      const { stdout } = require('node:process');
                      
                      const hmac = createHmac('sha256', 'a secret');
                      
                      const input = createReadStream('test.js');
                      input.pipe(hmac).pipe(stdout);
                      33. The special value
                      import { createReadStream } from 'node:fs';
                      import { stdout } from 'node:process';
                      const {
                        createHmac,
                      } = await import('node:crypto');
                      
                      const hmac = createHmac('sha256', 'a secret');
                      
                      const input = createReadStream('test.js');
                      input.pipe(hmac).pipe(stdout);const {
                        createReadStream,
                      } = require('node:fs');
                      const {
                        createHmac,
                      } = require('node:crypto');
                      const { stdout } = require('node:process');
                      
                      const hmac = createHmac('sha256', 'a secret');
                      
                      const input = createReadStream('test.js');
                      input.pipe(hmac).pipe(stdout);
                      36 sets the salt length to the digest size,
                      import { createReadStream } from 'node:fs';
                      import { stdout } from 'node:process';
                      const {
                        createHmac,
                      } = await import('node:crypto');
                      
                      const hmac = createHmac('sha256', 'a secret');
                      
                      const input = createReadStream('test.js');
                      input.pipe(hmac).pipe(stdout);const {
                        createReadStream,
                      } = require('node:fs');
                      const {
                        createHmac,
                      } = require('node:crypto');
                      const { stdout } = require('node:process');
                      
                      const hmac = createHmac('sha256', 'a secret');
                      
                      const input = createReadStream('test.js');
                      input.pipe(hmac).pipe(stdout);
                      37 (default) sets it to the maximum permissible value

                    Argumen

                    import { createReadStream } from 'node:fs';
                    import { stdout } from 'node:process';
                    const {
                      createHmac,
                    } = await import('node:crypto');
                    
                    const hmac = createHmac('sha256', 'a secret');
                    
                    const input = createReadStream('test.js');
                    input.pipe(hmac).pipe(stdout);const {
                      createReadStream,
                    } = require('node:fs');
                    const {
                      createHmac,
                    } = require('node:crypto');
                    const { stdout } = require('node:process');
                    
                    const hmac = createHmac('sha256', 'a secret');
                    
                    const input = createReadStream('test.js');
                    input.pipe(hmac).pipe(stdout);
                    _82 adalah tanda tangan yang dihitung sebelumnya untuk
                    import { Buffer } from 'node:buffer';
                    const { randomFill } = await import('node:crypto');
                    
                    const a = new Uint32Array(10);
                    randomFill(a, (err, buf) => {
                      if (err) throw err;
                      console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                        .toString('hex'));
                    });
                    
                    const b = new DataView(new ArrayBuffer(10));
                    randomFill(b, (err, buf) => {
                      if (err) throw err;
                      console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                        .toString('hex'));
                    });
                    
                    const c = new ArrayBuffer(10);
                    randomFill(c, (err, buf) => {
                      if (err) throw err;
                      console.log(Buffer.from(buf).toString('hex'));
                    });const { randomFill } = require('node:crypto');
                    const { Buffer } = require('node:buffer');
                    
                    const a = new Uint32Array(10);
                    randomFill(a, (err, buf) => {
                      if (err) throw err;
                      console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                        .toString('hex'));
                    });
                    
                    const b = new DataView(new ArrayBuffer(10));
                    randomFill(b, (err, buf) => {
                      if (err) throw err;
                      console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
                        .toString('hex'));
                    });
                    
                    const c = new ArrayBuffer(10);
                    randomFill(c, (err, buf) => {
                      if (err) throw err;
                      console.log(Buffer.from(buf).toString('hex'));
                    });
                    5

                    Karena kunci publik dapat diturunkan dari kunci privat, kunci privat atau kunci publik dapat diteruskan untuk

                    const { Certificate } = await import('node:crypto');
                    
                    const cert1 = new Certificate();
                    const cert2 = Certificate();const { Certificate } = require('node:crypto');
                    
                    const cert1 = new Certificate();
                    const cert2 = Certificate();
                    63

                    Jika fungsi

                    const { X509Certificate } = await import('node:crypto');
                    
                    const x509 = new X509Certificate('{.. pem encoded cert ...}');
                    
                    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
                    
                    const x509 = new X509Certificate('{.. pem encoded cert ...}');
                    
                    console.log(x509.subject);
                    _84 disediakan, fungsi ini menggunakan threadpool libuv

                    let crypto;
                    try {
                      crypto = await import('node:crypto');
                    } catch (err) {
                      console.error('crypto support is disabled!');
                    }
                    _472

                    Tipe. An implementation of the Web Crypto API standard

                    Lihat dokumentasi Web Crypto API untuk detailnya

                    catatan

                    Menggunakan string sebagai input ke API kriptografi

                    Untuk alasan historis, banyak API kriptografi yang disediakan oleh Node. js menerima string sebagai input di mana algoritme kriptografi yang mendasarinya bekerja pada urutan byte. Contoh ini termasuk teks biasa, teks cipher, kunci simetris, vektor inisialisasi, frasa sandi, garam, tag autentikasi, dan data autentikasi tambahan

                    Saat meneruskan string ke API kriptografi, pertimbangkan faktor-faktor berikut

                    • Tidak semua urutan byte adalah string UTF-8 yang valid. Oleh karena itu, ketika urutan byte dengan panjang

                      let crypto;
                      try {
                        crypto = await import('node:crypto');
                      } catch (err) {
                        console.error('crypto support is disabled!');
                      }
                      _325 diturunkan dari string, entropinya umumnya lebih rendah daripada entropi acak atau pseudorandom
                      let crypto;
                      try {
                        crypto = await import('node:crypto');
                      } catch (err) {
                        console.error('crypto support is disabled!');
                      }
                      325 urutan byte. Misalnya, tidak ada string UTF-8 yang akan menghasilkan urutan byte
                      let crypto;
                      try {
                        crypto = await import('node:crypto');
                      } catch (err) {
                        console.error('crypto support is disabled!');
                      }
                      475. Kunci rahasia harus hampir secara eksklusif berupa urutan byte acak atau pseudorandom

                    • Similarly, when converting random or pseudorandom byte sequences to UTF-8 strings, subsequences that do not represent valid code points may be replaced by the Unicode replacement character (

                      let crypto;
                      try {
                        crypto = await import('node:crypto');
                      } catch (err) {
                        console.error('crypto support is disabled!');
                      }
                      476). Oleh karena itu, representasi byte dari string Unicode yang dihasilkan mungkin tidak sama dengan urutan byte dari mana string itu dibuat

                      Keluaran sandi, fungsi hash, algoritme tanda tangan, dan fungsi derivasi kunci adalah urutan byte pseudorandom dan tidak boleh digunakan sebagai string Unicode

                    • Ketika string diperoleh dari input pengguna, beberapa karakter Unicode dapat direpresentasikan dalam beberapa cara yang setara yang menghasilkan urutan byte yang berbeda. Misalnya, saat meneruskan kata sandi pengguna ke fungsi derivasi kunci, seperti PBKDF2 atau scrypt, hasil dari fungsi derivasi kunci bergantung pada apakah string menggunakan karakter tersusun atau terdekomposisi. Jangan berikan. js tidak menormalkan representasi karakter. Pengembang harus mempertimbangkan untuk menggunakan

                      let crypto;
                      try {
                        crypto = await import('node:crypto');
                      } catch (err) {
                        console.error('crypto support is disabled!');
                      }
                      _477 pada input pengguna sebelum meneruskannya ke API kriptografi

                    API aliran lama (sebelum Node. js 0. 10)

                    Modul Crypto ditambahkan ke Node. js sebelum ada konsep Stream API terpadu, dan sebelum ada

                    import { createReadStream } from 'node:fs';
                    import { stdout } from 'node:process';
                    const {
                      createHmac,
                    } = await import('node:crypto');
                    
                    const hmac = createHmac('sha256', 'a secret');
                    
                    const input = createReadStream('test.js');
                    input.pipe(hmac).pipe(stdout);const {
                      createReadStream,
                    } = require('node:fs');
                    const {
                      createHmac,
                    } = require('node:crypto');
                    const { stdout } = require('node:process');
                    
                    const hmac = createHmac('sha256', 'a secret');
                    
                    const input = createReadStream('test.js');
                    input.pipe(hmac).pipe(stdout);
                    3 objek untuk menangani data biner. Dengan demikian, banyak dari
                    let crypto;
                    try {
                      crypto = await import('node:crypto');
                    } catch (err) {
                      console.error('crypto support is disabled!');
                    }
                    _3 kelas yang didefinisikan memiliki metode yang biasanya tidak ditemukan di Node lain. kelas js yang mengimplementasikan stream API (dan. g.
                    let crypto;
                    try {
                      crypto = await import('node:crypto');
                    } catch (err) {
                      console.error('crypto support is disabled!');
                    }
                    480,
                    let crypto;
                    try {
                      crypto = await import('node:crypto');
                    } catch (err) {
                      console.error('crypto support is disabled!');
                    }
                    481, atau
                    let crypto;
                    try {
                      crypto = await import('node:crypto');
                    } catch (err) {
                      console.error('crypto support is disabled!');
                    }
                    482). Juga, banyak metode menerima dan mengembalikan
                    const { X509Certificate } = await import('node:crypto');
                    
                    const x509 = new X509Certificate('{.. pem encoded cert ...}');
                    
                    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
                    
                    const x509 = new X509Certificate('{.. pem encoded cert ...}');
                    
                    console.log(x509.subject);
                    78 string yang disandikan secara default daripada
                    import { createReadStream } from 'node:fs';
                    import { stdout } from 'node:process';
                    const {
                      createHmac,
                    } = await import('node:crypto');
                    
                    const hmac = createHmac('sha256', 'a secret');
                    
                    const input = createReadStream('test.js');
                    input.pipe(hmac).pipe(stdout);const {
                      createReadStream,
                    } = require('node:fs');
                    const {
                      createHmac,
                    } = require('node:crypto');
                    const { stdout } = require('node:process');
                    
                    const hmac = createHmac('sha256', 'a secret');
                    
                    const input = createReadStream('test.js');
                    input.pipe(hmac).pipe(stdout);
                    3s. Default ini diubah setelah Node. js v0. 8 untuk menggunakan objek
                    import { createReadStream } from 'node:fs';
                    import { stdout } from 'node:process';
                    const {
                      createHmac,
                    } = await import('node:crypto');
                    
                    const hmac = createHmac('sha256', 'a secret');
                    
                    const input = createReadStream('test.js');
                    input.pipe(hmac).pipe(stdout);const {
                      createReadStream,
                    } = require('node:fs');
                    const {
                      createHmac,
                    } = require('node:crypto');
                    const { stdout } = require('node:process');
                    
                    const hmac = createHmac('sha256', 'a secret');
                    
                    const input = createReadStream('test.js');
                    input.pipe(hmac).pipe(stdout);
                    _3 sebagai gantinya

                    Dukungan untuk algoritme yang lemah atau disusupi

                    Modul

                    let crypto;
                    try {
                      crypto = await import('node:crypto');
                    } catch (err) {
                      console.error('crypto support is disabled!');
                    }
                    0 masih mendukung beberapa algoritme yang telah disusupi dan saat ini tidak direkomendasikan untuk digunakan. API juga memungkinkan penggunaan sandi dan hash dengan ukuran kunci kecil yang terlalu lemah untuk penggunaan yang aman

                    Pengguna harus bertanggung jawab penuh untuk memilih algoritme crypto dan ukuran kunci sesuai dengan kebutuhan keamanan mereka

                    Berdasarkan rekomendasi NIST SP 800-131A

                    • MD5 dan SHA-1 tidak lagi dapat diterima jika diperlukan resistensi benturan seperti tanda tangan digital
                    • Kunci yang digunakan dengan algoritma RSA, DSA, dan DH disarankan untuk memiliki setidaknya 2048 bit dan kurva ECDSA dan ECDH setidaknya 224 bit, agar aman digunakan selama beberapa tahun
                    • Grup DH
                      let crypto;
                      try {
                        crypto = await import('node:crypto');
                      } catch (err) {
                        console.error('crypto support is disabled!');
                      }
                      487,
                      let crypto;
                      try {
                        crypto = await import('node:crypto');
                      } catch (err) {
                        console.error('crypto support is disabled!');
                      }
                      488 dan
                      let crypto;
                      try {
                        crypto = await import('node:crypto');
                      } catch (err) {
                        console.error('crypto support is disabled!');
                      }
                      489 memiliki ukuran kunci yang lebih kecil dari 2048 bit dan tidak disarankan

                    Lihat referensi untuk rekomendasi dan detail lainnya

                    Beberapa algoritme yang memiliki kelemahan yang diketahui dan memiliki sedikit relevansi dalam praktiknya hanya tersedia melalui , yang tidak diaktifkan secara default

                    modus CCM

                    CCM adalah salah satu algoritma AEAD yang didukung. Aplikasi yang menggunakan mode ini harus mematuhi batasan tertentu saat menggunakan cipher API

                    • Panjang tag autentikasi harus ditentukan selama pembuatan sandi dengan menyetel opsi
                      const { X509Certificate } = await import('node:crypto');
                      
                      const x509 = new X509Certificate('{.. pem encoded cert ...}');
                      
                      console.log(x509.subject);const { X509Certificate } = require('node:crypto');
                      
                      const x509 = new X509Certificate('{.. pem encoded cert ...}');
                      
                      console.log(x509.subject);
                      _6 dan harus salah satu dari 4, 6, 8, 10, 12, 14, atau 16 byte
                    • Panjang vektor inisialisasi (nonce)
                      let crypto;
                      try {
                        crypto = await import('node:crypto');
                      } catch (err) {
                        console.error('crypto support is disabled!');
                      }
                      491 harus antara 7 dan 13 byte (
                      let crypto;
                      try {
                        crypto = await import('node:crypto');
                      } catch (err) {
                        console.error('crypto support is disabled!');
                      }
                      492)
                    • Panjang plainteks dibatasi hingga
                      let crypto;
                      try {
                        crypto = await import('node:crypto');
                      } catch (err) {
                        console.error('crypto support is disabled!');
                      }
                      493 byte
                    • Saat mendekripsi, tag otentikasi harus diatur melalui
                      let crypto;
                      try {
                        crypto = await import('node:crypto');
                      } catch (err) {
                        console.error('crypto support is disabled!');
                      }
                      494 sebelum memanggil
                      let crypto;
                      try {
                        crypto = await import('node:crypto');
                      } catch (err) {
                        console.error('crypto support is disabled!');
                      }
                      480. Jika tidak, dekripsi akan gagal dan
                      let crypto;
                      try {
                        crypto = await import('node:crypto');
                      } catch (err) {
                        console.error('crypto support is disabled!');
                      }
                      _481 akan menimbulkan kesalahan sesuai dengan bagian 2. 6 dari RFC 3610
                    • Menggunakan metode aliran seperti
                      let crypto;
                      try {
                        crypto = await import('node:crypto');
                      } catch (err) {
                        console.error('crypto support is disabled!');
                      }
                      497,
                      let crypto;
                      try {
                        crypto = await import('node:crypto');
                      } catch (err) {
                        console.error('crypto support is disabled!');
                      }
                      498 atau
                      let crypto;
                      try {
                        crypto = await import('node:crypto');
                      } catch (err) {
                        console.error('crypto support is disabled!');
                      }
                      499 dalam mode CCM mungkin gagal karena CCM tidak dapat menangani lebih dari satu potongan data per instans
                    • Saat meneruskan data tambahan yang diautentikasi (AAD), panjang pesan sebenarnya dalam byte harus diteruskan ke
                      let crypto;
                      try {
                        crypto = await import('node:crypto');
                      } catch (err) {
                        console.error('crypto support is disabled!');
                      }
                      500 melalui opsi
                      const {
                        generateKeyPairSync,
                      } = await import('node:crypto');
                      
                      const {
                        publicKey,
                        privateKey,
                      } = generateKeyPairSync('rsa', {
                        modulusLength: 4096,
                        publicKeyEncoding: {
                          type: 'spki',
                          format: 'pem',
                        },
                        privateKeyEncoding: {
                          type: 'pkcs8',
                          format: 'pem',
                          cipher: 'aes-256-cbc',
                          passphrase: 'top secret',
                        },
                      });const {
                        generateKeyPairSync,
                      } = require('node:crypto');
                      
                      const {
                        publicKey,
                        privateKey,
                      } = generateKeyPairSync('rsa', {
                        modulusLength: 4096,
                        publicKeyEncoding: {
                          type: 'spki',
                          format: 'pem',
                        },
                        privateKeyEncoding: {
                          type: 'pkcs8',
                          format: 'pem',
                          cipher: 'aes-256-cbc',
                          passphrase: 'top secret',
                        },
                      });
                      5. Banyak perpustakaan crypto menyertakan tag otentikasi dalam ciphertext, yang berarti mereka menghasilkan ciphertext dengan panjang
                      let crypto;
                      try {
                        crypto = await import('node:crypto');
                      } catch (err) {
                        console.error('crypto support is disabled!');
                      }
                      502. Jangan berikan. js tidak menyertakan tag autentikasi, sehingga panjang ciphertext selalu
                      const {
                        generateKeyPairSync,
                      } = await import('node:crypto');
                      
                      const {
                        publicKey,
                        privateKey,
                      } = generateKeyPairSync('rsa', {
                        modulusLength: 4096,
                        publicKeyEncoding: {
                          type: 'spki',
                          format: 'pem',
                        },
                        privateKeyEncoding: {
                          type: 'pkcs8',
                          format: 'pem',
                          cipher: 'aes-256-cbc',
                          passphrase: 'top secret',
                        },
                      });const {
                        generateKeyPairSync,
                      } = require('node:crypto');
                      
                      const {
                        publicKey,
                        privateKey,
                      } = generateKeyPairSync('rsa', {
                        modulusLength: 4096,
                        publicKeyEncoding: {
                          type: 'spki',
                          format: 'pem',
                        },
                        privateKeyEncoding: {
                          type: 'pkcs8',
                          format: 'pem',
                          cipher: 'aes-256-cbc',
                          passphrase: 'top secret',
                        },
                      });
                      5. Ini tidak diperlukan jika tidak ada AAD yang digunakan
                    • Saat CCM memproses seluruh pesan sekaligus,
                      let crypto;
                      try {
                        crypto = await import('node:crypto');
                      } catch (err) {
                        console.error('crypto support is disabled!');
                      }
                      480 harus dipanggil tepat satu kali
                    • Meskipun memanggil
                      let crypto;
                      try {
                        crypto = await import('node:crypto');
                      } catch (err) {
                        console.error('crypto support is disabled!');
                      }
                      _480 sudah cukup untuk mengenkripsi/mendekripsi pesan, aplikasi harus memanggil
                      let crypto;
                      try {
                        crypto = await import('node:crypto');
                      } catch (err) {
                        console.error('crypto support is disabled!');
                      }
                      481 untuk menghitung atau memverifikasi tag autentikasi

                    konstanta kripto

                    Konstanta berikut yang diekspor oleh

                    const { X509Certificate } = await import('node:crypto');
                    
                    const x509 = new X509Certificate('{.. pem encoded cert ...}');
                    
                    console.log(x509.subject);const { X509Certificate } = require('node:crypto');
                    
                    const x509 = new X509Certificate('{.. pem encoded cert ...}');
                    
                    console.log(x509.subject);
                    _73 berlaku untuk berbagai penggunaan modul
                    let crypto;
                    try {
                      crypto = await import('node:crypto');
                    } catch (err) {
                      console.error('crypto support is disabled!');
                    }
                    0,
                    let crypto;
                    try {
                      crypto = await import('node:crypto');
                    } catch (err) {
                      console.error('crypto support is disabled!');
                    }
                    509, dan
                    let crypto;
                    try {
                      crypto = await import('node:crypto');
                    } catch (err) {
                      console.error('crypto support is disabled!');
                    }
                    510 dan umumnya khusus untuk OpenSSL