Skip to content

Commit

Permalink
Changed the order of the parameters passed to the Mode Constructor to be
Browse files Browse the repository at this point in the history
consistent with the rest of the API
  • Loading branch information
gilfether committed Jul 19, 2013
1 parent 8adfab1 commit 2d3af13
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion modes/CBC.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class Mode_CBC extends Mode
*/
function __construct($cipher)
{
parent::__construct($cipher, PHP_Crypt::MODE_CBC);
parent::__construct(PHP_Crypt::MODE_CBC, $cipher);

// get the bit size the Cipher requires
$this->blockSize($cipher->bitSize() / 8);
Expand Down
2 changes: 1 addition & 1 deletion modes/CFB.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class Mode_CFB extends Mode
*/
public function __construct($cipher)
{
parent::__construct($cipher, PHP_Crypt::MODE_CFB);
parent::__construct(PHP_Crypt::MODE_CFB, $cipher);

// our block size will be the size required by the cipher
$this->blockSize($cipher->bitSize() / 8);
Expand Down
2 changes: 1 addition & 1 deletion modes/CTR.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class Mode_CTR extends Mode
*/
function __construct($cipher)
{
parent::__construct($cipher, PHP_CRYPT::MODE_CTR);
parent::__construct(PHP_CRYPT::MODE_CTR, $cipher);

// set the block size, in bits
$this->blockSize($cipher->bitSize() / 8);
Expand Down
2 changes: 1 addition & 1 deletion modes/ECB.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class Mode_ECB extends Mode
*/
public function __construct($cipher)
{
parent::__construct($cipher, PHP_Crypt::MODE_ECB);
parent::__construct(PHP_Crypt::MODE_ECB, $cipher);

// get the bit size the Cipher requires, divide by 8
// to set the number of bytes each block of data will be
Expand Down
2 changes: 1 addition & 1 deletion modes/NCFB.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class Mode_NCFB extends Mode
*/
public function __construct($cipher)
{
parent::__construct($cipher, PHP_Crypt::MODE_NCFB);
parent::__construct(PHP_Crypt::MODE_NCFB, $cipher);

// our block size will be the size required by the cipher
$this->blockSize($cipher->bitSize() / 8);
Expand Down
2 changes: 1 addition & 1 deletion modes/NOFB.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class Mode_NOFB extends Mode
*/
public function __construct($cipher)
{
parent::__construct($cipher, PHP_Crypt::MODE_NOFB);
parent::__construct(PHP_Crypt::MODE_NOFB, $cipher);

// our block size will be the size required by the cipher
$this->blockSize($cipher->bitSize() / 8);
Expand Down
2 changes: 1 addition & 1 deletion modes/OFB.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class Mode_OFB extends Mode
*/
public function __construct($cipher)
{
parent::__construct($cipher, PHP_Crypt::MODE_OFB);
parent::__construct(PHP_Crypt::MODE_OFB, $cipher);

// our block size will be the size required by the cipher
$this->blockSize($cipher->bitSize() / 8);
Expand Down
2 changes: 1 addition & 1 deletion modes/PCBC.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class Mode_PCBC extends Mode
*/
function __construct($cipher)
{
parent::__construct($cipher, PHP_Crypt::MODE_PCBC);
parent::__construct(PHP_Crypt::MODE_PCBC, $cipher);

$this->blockSize($cipher->bitSize() / 8);

Expand Down
6 changes: 3 additions & 3 deletions modes/Raw.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class Mode_Raw extends Mode
*/
public function __construct($cipher)
{
parent::__construct($cipher, PHP_Crypt::MODE_RAW);
parent::__construct(PHP_Crypt::MODE_RAW, $cipher);

// get the bit size the Cipher requires
if($cipher->type() == Cipher::BLOCK)
Expand All @@ -66,9 +66,9 @@ public function __construct($cipher)
* @param integer $mode The mode constant identifier
* @return void
*/
protected function __construct1($cipher, $mode)
protected function __construct1($mode, $cipher)
{
parent::__construct($cipher, $mode);
parent::__construct($mode, $cipher);
}


Expand Down
2 changes: 1 addition & 1 deletion modes/Stream.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class Mode_Stream extends Mode_Raw
public function __construct($cipher)
{
// call the secondary 'constructor' from the parent
parent::__construct1($cipher, PHP_Crypt::MODE_STREAM);
parent::__construct1(PHP_Crypt::MODE_STREAM, $cipher);

// Stream ciphers don't use block sizes, set to 0
$this->blockSize(0);
Expand Down

0 comments on commit 2d3af13

Please sign in to comment.