for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Dcrypt\Support;
class Support
{
public static function mcryptCiphers()
return array(
MCRYPT_3DES,
MCRYPT_BLOWFISH,
MCRYPT_BLOWFISH_COMPAT,
MCRYPT_DES,
MCRYPT_LOKI97,
MCRYPT_CAST_128,
MCRYPT_CAST_256,
MCRYPT_RC2,
MCRYPT_RIJNDAEL_128,
MCRYPT_RIJNDAEL_192,
MCRYPT_RIJNDAEL_256,
MCRYPT_SAFERPLUS,
MCRYPT_SERPENT,
MCRYPT_TRIPLEDES,
MCRYPT_TWOFISH,
MCRYPT_XTEA,
);
}
public static function mcryptModes()
MCRYPT_MODE_CBC,
MCRYPT_MODE_CFB,
MCRYPT_MODE_ECB,
MCRYPT_MODE_OFB,
MCRYPT_MODE_NOFB,
/**
* Change a random byte, randomly. This function is used in unit testing
* only and never in the namespaced areas of code.
*
* @param string $input
* @return string
*/
public static function swaprandbyte($input)
// @codeCoverageIgnoreStart
$len = strlen($input);
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.
To visualize
$a = "a"; $ab = "ab"; $abc = "abc";
will produce issues in the first and second line, while this second example
will produce no issues.
$input = str_split($input);
$offset = rand(0, $len - 1);
$byte = $input[$offset];
$rbyte = \Dcrypt\Random::bytes(1);
if ($byte === $rbyte) {
$rbyte = (ord($rbyte) + 1) % 256;
$rbyte = chr($rbyte);
$input[$offset] = $rbyte;
// @codeCoverageIgnoreEnd
return implode($input);
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.
To visualize
will produce issues in the first and second line, while this second example
will produce no issues.