Req #66650 [Csd->Wfx]: Support for CTR mode
Edit report at https://bugs.php.net/bug.php?id=66650&edit=1
ID: 66650
Updated by: cmb@php.net
Reported by: clicky at erebot dot net
Summary: Support for CTR mode
-Status: Closed
+Status: Wont fix
Type: Feature/Change Request
Package: mcrypt related
Operating System: Any
PHP Version: Irrelevant
Assigned To: cmb
Block user comment: N
Private report: N
Previous Comments:
------------------------------------------------------------------------
[2016-08-03 16:31:23] cmb@php.net
> I'd rather suggest to deprecate usage of the MCRYPT_MODE_*
> constants.
Actually, the complete mcrypt extension is deprecated as of PHP
7.1.0, so it doesn't make sense to add new features to it.
------------------------------------------------------------------------
[2014-03-06 11:55:02] narf at devilix dot net
You can use ctr mode by just passing 'ctr' to mcrypt_encrypt(). All of the MCRYPT_MODE_*
constants just define strings and are not actually necessary. In fact they don't help you with
anything.
MCRYPT_MODE_CBC = 'cbc'
MCRYPT_MODE_ECB = 'ecb'
etc.
I'd rather suggest to deprecate usage of the MCRYPT_MODE_* constants.
------------------------------------------------------------------------
[2014-02-05 21:36:23] clicky at erebot dot net
Description:
------------
Please add support for the CTR encryption mode (MCRYPT_MODE_CTR).
See also attached patch against PHP 5.5.x which adds the necessary code and also defines a
deprecated function mcrypt_ctr() (for consistency with other modes).
Test script:
---------------
<?php
$key = "FooBar";
$secret = "PHP Testfest 2008";
$cipher = MCRYPT_RIJNDAEL_128;
$iv = mcrypt_create_iv(mcrypt_get_iv_size($cipher, MCRYPT_MODE_CTR), MCRYPT_RAND);
$enc_data = mcrypt_ctr($cipher, $key, $secret, MCRYPT_ENCRYPT, $iv);
var_dump(bin2hex($enc_data));
?>
Expected result:
----------------
string(34) "5e42855e8236dacdb8fafbdaa12d176f13"
Actual result:
--------------
Bunch of errors due to lack of MCRYPT_MODE_CTR constant and undefined function mcrypt_ctr().
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=66650&edit=1
Thread (4 messages)