by Anish
Posted on Thursday December 13 , 2018
An IV or initialization vector is, in its broadest sense, just the initial value used to start some iterated process. The term is used in a couple of different contexts, and implies different security requirements in each of them. For example, cryptographic hash functions typically have a fixed IV.
Conversely, most block cipher modes of operation require an IV which is random and unpredictable, or at least unique for each message encrypted with a given key. Different block cipher modes have different IV length requirement.
openssl_cipher_iv_length: Gets the Cipher initialization vector (iv) Length
The Syntax
int openssl_cipher_iv_length ( string $method )
FALSE
on failureExamples
openssl_cipher_iv_length() example
<?php
/**
* Created by https://8gwifi.org
* User: Anish Nath
* Date: 2018-12-13 * Time: 09:25
* */
$ciphers = openssl_get_cipher_methods();
//ECB mode should be avoided
$ciphers = array_filter($ciphers, function ($n) {
return stripos($n, "ecb") === FALSE;
});
// Openssl declared the following weak: RC2, RC4, DES, 3DES, MD5 based
$ciphers = array_filter($ciphers, function ($c) {
return stripos($c, "des") === FALSE;
});
$ciphers = array_filter($ciphers, function ($c) {
return stripos($c, "rc2") === FALSE;
});
$ciphers = array_filter($ciphers, function ($c) {
return stripos($c, "rc4") === FALSE;
});
$ciphers = array_filter($ciphers, function ($c) {
return stripos($c, "md5") === FALSE;
});
if (is_array($ciphers)) {
foreach ($ciphers as $cipher) {
echo $cipher.': ';
echo openssl_cipher_iv_length($cipher);
echo "\n";
}
}
The above example will output something similar to:
$ /usr/bin/php get_iv_length.php
AES-128-CBC: 16
AES-128-CFB: 16
AES-128-CFB1: 16
AES-128-CFB8: 16
AES-128-CTR: 16
AES-128-OFB: 16
AES-128-XTS: 16
AES-192-CBC: 16
AES-192-CFB: 16
AES-192-CFB1: 16
AES-192-CFB8: 16
AES-192-CTR: 16
AES-192-OFB: 16
AES-256-CBC: 16
AES-256-CFB: 16
AES-256-CFB1: 16
AES-256-CFB8: 16
AES-256-CTR: 16
AES-256-OFB: 16
AES-256-XTS: 16
BF-CBC: 8
BF-CFB: 8
BF-OFB: 8
CAMELLIA-128-CBC: 16
CAMELLIA-128-CFB: 16
CAMELLIA-128-CFB1: 16
CAMELLIA-128-CFB8: 16
CAMELLIA-128-OFB: 16
CAMELLIA-192-CBC: 16
CAMELLIA-192-CFB: 16
CAMELLIA-192-CFB1: 16
CAMELLIA-192-CFB8: 16
CAMELLIA-192-OFB: 16
CAMELLIA-256-CBC: 16
CAMELLIA-256-CFB: 16
CAMELLIA-256-CFB1: 16
CAMELLIA-256-CFB8: 16
CAMELLIA-256-OFB: 16
CAST5-CBC: 8
CAST5-CFB: 8
CAST5-OFB: 8
ChaCha: 8
GOST 28147-89: 8
aes-128-cbc: 16
aes-128-cfb: 16
aes-128-cfb1: 16
aes-128-cfb8: 16
aes-128-ctr: 16
aes-128-gcm: 12
aes-128-ofb: 16
aes-128-xts: 16
aes-192-cbc: 16
aes-192-cfb: 16
aes-192-cfb1: 16
aes-192-cfb8: 16
aes-192-ctr: 16
aes-192-gcm: 12
aes-192-ofb: 16
aes-256-cbc: 16
aes-256-cfb: 16
aes-256-cfb1: 16
aes-256-cfb8: 16
aes-256-ctr: 16
aes-256-gcm: 12
aes-256-ofb: 16
aes-256-xts: 16
bf-cbc: 8
bf-cfb: 8
bf-ofb: 8
camellia-128-cbc: 16
camellia-128-cfb: 16
camellia-128-cfb1: 16
camellia-128-cfb8: 16
camellia-128-ofb: 16
camellia-192-cbc: 16
camellia-192-cfb: 16
camellia-192-cfb1: 16
camellia-192-cfb8: 16
camellia-192-ofb: 16
camellia-256-cbc: 16
camellia-256-cfb: 16
camellia-256-cfb1: 16
camellia-256-cfb8: 16
camellia-256-ofb: 16
cast5-cbc: 8
cast5-cfb: 8
cast5-ofb: 8
chacha: 8
gost89: 8
gost89-cnt: 8
id-aes128-GCM: 12
id-aes192-GCM: 12
id-aes256-GCM: 12
Thanku for reading !!! Give a Share for Support
Instead of directly asking for donations, I'm thrilled to offer you all nine of my books for just $9 on leanpub By grabbing this bundle you not only help cover my coffee, beer, and Amazon bills but also play a crucial role in advancing and refining this project. Your contribution is indispensable, and I'm genuinely grateful for your involvement in this journey!
Any private key value that you enter or we generate is not stored on this site, this tool is provided via an HTTPS URL to ensure that private keys cannot be stolen, for extra security run this software on your network, no cloud dependency