CakeFest 2024: The Official CakePHP Conference

mcrypt_enc_get_supported_key_sizes

(PHP 4 >= 4.0.2, PHP 5, PHP 7 < 7.2.0, PECL mcrypt >= 1.0.0)

mcrypt_enc_get_supported_key_sizes以数组方式返回打开的算法所支持的密钥长度

警告

本函数已自 PHP 7.1.0 起废弃并将自 PHP 7.2.0 起移除。强烈建议不要使用本函数。

说明

mcrypt_enc_get_supported_key_sizes(resource $td): array

获取打开的算法所支持的密钥长度。

参数

td

加密描述符。

返回值

返回由加密描述符指定的算法所能够支持的密钥长度。 如果该算法支持从 1 到 mcrypt_enc_get_key_size() 之间任意长度的密钥,则返回空数组。

示例

示例 #1 mcrypt_enc_get_supported_key_sizes() 示例

<?php
$td
= mcrypt_module_open('rijndael-256', '', 'ecb', '');
var_dump(mcrypt_enc_get_supported_key_sizes($td));
?>

以上示例会输出:

array(3) {
  [0]=>
  int(16)
  [1]=>
  int(24)
  [2]=>
  int(32)
}

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top