Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).
Version | System time (s) | User time (s) | Memory (MiB) |
---|---|---|---|
7.1.7 | 0.008 | 0.007 | 17.29 |
<?php
$algo = 'aes-256-gcm';
$iv = random_bytes(openssl_cipher_iv_length($algo));
$key = random_bytes(32); // 256 bit
$data = random_bytes(32); // 1 Kb of random data
//$data = "";
$ciphertext = openssl_encrypt(
$data,
$algo,
$key,
OPENSSL_RAW_DATA,
$iv,
$tag
);
// Change 1 bit in ciphertext
// $i = rand(0, mb_strlen($ciphertext, '8bit') - 1);
// $ciphertext[$i] = $ciphertext[$i] ^ chr(1);
echo(base64_encode($ciphertext));
echo("\n");
echo(mb_strlen($ciphertext, '8bit'));
echo("\n");
$decrypt = openssl_decrypt(
$ciphertext,
$algo,
$key,
OPENSSL_RAW_DATA,
$iv,
$tag
);
if (false === $decrypt) {
throw new Exception(sprintf(
"OpenSSL error: %s", openssl_error_string()
));
}
printf ("Decryption %s\n", $data === $decrypt ? 'Ok' : 'Failed');
Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).
Version | System time (s) | User time (s) | Memory (MiB) |
---|---|---|---|
7.1.7 | 0.008 | 0.007 | 17.29 |