📜  PHP | openssl_get_cipher_methods()函数(1)

📅  最后修改于: 2023-12-03 14:45:18.374000             🧑  作者: Mango

PHP | openssl_get_cipher_methods()函数

openssl_get_cipher_methods()函数用于获取当前PHP版本支持的所有加密算法。

语法
openssl_get_cipher_methods([$aliases = false]);

$aliases参数是一个可选参数,如果设置为true,则返回的结果也包括了算法的别名。

返回值

返回一个数组,包含当前PHP版本支持的所有加密算法。

示例
<?php

// 获取所有加密算法
$ciphers = openssl_get_cipher_methods();
echo "当前PHP版本支持的所有加密算法:\n";
print_r($ciphers);

// 获取所有算法的别名
$aliases = openssl_get_cipher_methods(true);
echo "当前PHP版本支持的所有加密算法及其别名:\n";
print_r($aliases);

?>
返回结果
当前PHP版本支持的所有加密算法:
Array
(
    [0] => AES-128-CBC
    [1] => AES-128-CBC-HMAC-SHA1
    [2] => AES-128-CBC-HMAC-SHA256
    [3] => AES-128-CFB
    [4] => AES-128-CFB1
    [5] => AES-128-CFB8
    [6] => AES-128-CTR
    [7] => AES-128-ECB
    [8] => AES-128-OFB
    [9] => AES-192-CBC
    [10] => AES-192-CFB
    [11] => AES-192-CFB1
    [12] => AES-192-CFB8
    [13] => AES-192-CTR
    [14] => AES-192-ECB
    [15] => AES-192-OFB
    [16] => AES-256-CBC
    [17] => AES-256-CBC-HMAC-SHA1
    [18] => AES-256-CBC-HMAC-SHA256
    [19] => AES-256-CFB
    [20] => AES-256-CFB1
    [21] => AES-256-CFB8
    [22] => AES-256-CTR
    [23] => AES-256-ECB
    [24] => AES-256-OFB
    [25] => AES128
    [26] => AES192
    [27] => AES256
    [28] => BLOWFISH-CBC
    [29] => BLOWFISH-CFB
    [30] => BLOWFISH-ECB
    [31] => BLOWFISH-OFB
    [32] => CAMELLIA-128-CBC
    [33] => CAMELLIA-128-CFB
    [34] => CAMELLIA-128-CFB1
    [35] => CAMELLIA-128-CFB8
    [36] => CAMELLIA-128-ECB
    [37] => CAMELLIA-128-OFB
    [38] => CAMELLIA-192-CBC
    [39] => CAMELLIA-192-CFB
    [40] => CAMELLIA-192-CFB1
    [41] => CAMELLIA-192-CFB8
    [42] => CAMELLIA-192-ECB
    [43] => CAMELLIA-192-OFB
    [44] => CAMELLIA-256-CBC
    [45] => CAMELLIA-256-CFB
    [46] => CAMELLIA-256-CFB1
    [47] => CAMELLIA-256-CFB8
    [48] => CAMELLIA-256-ECB
    [49] => CAMELLIA-256-OFB
    [50] => CAST5-CBC
    [51] => CAST5-CFB
    [52] => CAST5-ECB
    [53] => CAST5-OFB
    [54] => CHACHA20
    [55] => CHACHA20-POLY1305
    [56] => DES-CBC
    [57] => DES-CFB
    [58] => DES-CFB1
    [59] => DES-CFB8
    [60] => DES-ECB
    [61] => DES-EDE
    [62] => DES-EDE-CBC
    [63] => DES-EDE-CFB
    [64] => DES-EDE-OFB
    [65] => DES-EDE3
    [66] => DES-EDE3-CBC
    [67] => DES-EDE3-CFB
    [68] => DES-EDE3-CFB1
    [69] => DES-EDE3-CFB8
    [70] => DES-EDE3-OFB
    [71] => DES-OFB
    [72] => DESX-CBC
    [73] => IDEA-CBC
    [74] => IDEA-CFB
    [75] => IDEA-ECB
    [76] => IDEA-OFB
    [77] => RC2-40-CBC
    [78] => RC2-64-CBC
    [79] => RC2-CBC
    [80] => RC2-CFB
    [81] => RC2-ECB
    [82] => RC2-OFB
    [83] => RC4
    [84] => RC4-40
    [85] => RC4-HMAC-MD5
    [86] => SEED-CBC
    [87] => SEED-CFB
    [88] => SEED-ECB
    [89] => SEED-OFB
)
当前PHP版本支持的所有加密算法及其别名:
Array
(
    [AES-128-CBC] => aes-128-cbc
    [AES-128-CBC-HMAC-SHA1] => aes-128-cbc-hmac-sha1
    [AES-128-CBC-HMAC-SHA256] => aes-128-cbc-hmac-sha256
    [AES-128-CFB] => aes-128-cfb
    [AES-128-CFB1] => aes-128-cfb1
    [AES-128-CFB8] => aes-128-cfb8
    [AES-128-CTR] => aes-128-ctr
    [AES-128-ECB] => aes-128-ecb
    [AES-128-OFB] => aes-128-ofb
    [AES-192-CBC] => aes-192-cbc
    [AES-192-CFB] => aes-192-cfb
    [AES-192-CFB1] => aes-192-cfb1
    [AES-192-CFB8] => aes-192-cfb8
    [AES-192-CTR] => aes-192-ctr
    [AES-192-ECB] => aes-192-ecb
    [AES-192-OFB] => aes-192-ofb
    [AES-256-CBC] => aes-256-cbc
    [AES-256-CBC-HMAC-SHA1] => aes-256-cbc-hmac-sha1
    [AES-256-CBC-HMAC-SHA256] => aes-256-cbc-hmac-sha256
    [AES-256-CFB] => aes-256-cfb
    [AES-256-CFB1] => aes-256-cfb1
    [AES-256-CFB8] => aes-256-cfb8
    [AES-256-CTR] => aes-256-ctr
    [AES-256-ECB] => aes-256-ecb
    [AES-256-OFB] => aes-256-ofb
    [AES128] => aes128
    [AES192] => aes192
    [AES256] => aes256
    [BLOWFISH-CBC] => bf-cbc
    [BLOWFISH-CFB] => bf-cfb
    [BLOWFISH-ECB] => bf-ecb
    [BLOWFISH-OFB] => bf-ofb
    [CAMELLIA-128-CBC] => camellia-128-cbc
    [CAMELLIA-128-CFB] => camellia-128-cfb
    [CAMELLIA-128-CFB1] => camellia-128-cfb1
    [CAMELLIA-128-CFB8] => camellia-128-cfb8
    [CAMELLIA-128-ECB] => camellia-128-ecb
    [CAMELLIA-128-OFB] => camellia-128-ofb
    [CAMELLIA-192-CBC] => camellia-192-cbc
    [CAMELLIA-192-CFB] => camellia-192-cfb
    [CAMELLIA-192-CFB1] => camellia-192-cfb1
    [CAMELLIA-192-CFB8] => camellia-192-cfb8
    [CAMELLIA-192-ECB] => camellia-192-ecb
    [CAMELLIA-192-OFB] => camellia-192-ofb
    [CAMELLIA-256-CBC] => camellia-256-cbc
    [CAMELLIA-256-CFB] => camellia-256-cfb
    [CAMELLIA-256-CFB1] => camellia-256-cfb1
    [CAMELLIA-256-CFB8] => camellia-256-cfb8
    [CAMELLIA-256-ECB] => camellia-256-ecb
    [CAMELLIA-256-OFB] => camellia-256-ofb
    [CAST5-CBC] => cast5-cbc
    [CAST5-CFB] => cast5-cfb
    [CAST5-ECB] => cast5-ecb
    [CAST5-OFB] => cast5-ofb
    [CHACHA20] => chacha20
    [CHACHA20-POLY1305] => chacha20-poly1305
    [DES-CBC] => des-cbc
    [DES-CFB] => des-cfb
    [DES-CFB1] => des-cfb1
    [DES-CFB8] => des-cfb8
    [DES-ECB] => des-ecb
    [DES-EDE] => des-ede
    [DES-EDE-CBC] => des-ede-cbc
    [DES-EDE-CFB] => des-ede-cfb
    [DES-EDE-OFB] => des-ede-ofb
    [DES-EDE3] => des-ede3
    [DES-EDE3-CBC] => des-ede3-cbc
    [DES-EDE3-CFB] => des-ede3-cfb
    [DES-EDE3-CFB1] => des-ede3-cfb1
    [DES-EDE3-CFB8] => des-ede3-cfb8
    [DES-EDE3-OFB] => des-ede3-ofb
    [DES-OFB] => des-ofb
    [DESX-CBC] => desx-cbc
    [IDEA-CBC] => idea-cbc
    [IDEA-CFB] => idea-cfb
    [IDEA-ECB] => idea-ecb
    [IDEA-OFB] => idea-ofb
    [RC2-40-CBC] => rc2-40-cbc
    [RC2-64-CBC] => rc2-64-cbc
    [RC2-CBC] => rc2-cbc
    [RC2-CFB] => rc2-cfb
    [RC2-ECB] => rc2-ecb
    [RC2-OFB] => rc2-ofb
    [RC4] => rc4
    [RC4-40] => rc4-40
    [RC4-HMAC-MD5] => rc4-hmac-md5
    [SEED-CBC] => seed-cbc
    [SEED-CFB] => seed-cfb
    [SEED-ECB] => seed-ecb
    [SEED-OFB] => seed-ofb
)