Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> การเขียนโปรแกรม >> JavaScript

เมธอด crypto.getCiphers() ใน Node.js

เมธอด crypto.getCiphers() คืนค่า array ที่มีชื่อ cipher algorithms ที่รองรับทั้งหมด อัลกอริทึมที่นิยมใช้มากที่สุดคือ AES (Advanced Encryption Standard)

ไวยากรณ์

crypto.getCiphers()

พารามิเตอร์

ไม่ต้องมีพารามิเตอร์

ตัวอย่าง

const crypto = require('crypto');
const cipher = crypto.getCiphers();
console.log("The list of all cipher algorithm are as follows: ", cipher);

ผลลัพธ์ (บางส่วน)

[
  'aes-128-cbc', 'aes-128-cbc-hmac-sha1', 'aes-128-cbc-hmac-sha256',
  'aes-128-ccm', 'aes-128-cfb', 'aes-128-cfb1', 'aes-128-cfb8',
  'aes-128-ctr', 'aes-128-ecb', 'aes-128-gcm', 'aes-128-ocb', 'aes-128-ofb', 'aes-128-xts',
  'aes-192-cbc', 'aes-192-ccm', 'aes-192-cfb', ...,
  'aes-256-cbc', 'aes-256-cbc-hmac-sha1', 'aes-256-cbc-hmac-sha256',
  'aes-256-ccm', 'aes-256-cfb', 'aes-256-cfb1', 'aes-256-cfb8',
  'aes-256-ctr', 'aes-256-ecb', 'aes-256-gcm', 'aes-256-ocb', 'aes-256-ofb', 'aes-256-xts',
  'aria-128-cbc', 'aria-128-ccm', ...,
  'camellia-128-cbc', 'camellia-128-cfb', ...,
  'bf', 'bf-cbc', 'bf-cfb', 'bf-ecb', 'bf-ofb', 'blowfish',
  ... 70 more items
]