From 9dec1fa1a0aa29c0d76a0e5f6832ed1172681038 Mon Sep 17 00:00:00 2001 From: Jakob Schumann Date: Tue, 10 Oct 2017 11:53:23 +0200 Subject: [PATCH] del: RandomLib/Source/Mcrypt - mcrypt is deprecated --- src/RandomLib/Source/Mcrypt.php | 46 --------------------------------- 1 file changed, 46 deletions(-) delete mode 100644 src/RandomLib/Source/Mcrypt.php diff --git a/src/RandomLib/Source/Mcrypt.php b/src/RandomLib/Source/Mcrypt.php deleted file mode 100644 index 75ab778..0000000 --- a/src/RandomLib/Source/Mcrypt.php +++ /dev/null @@ -1,46 +0,0 @@ - - */ - -namespace Vrok\RandomLib\Source; - -use RandomLib\Source; -use SecurityLib\Strength; - -/** - * Uses ext/mcrypt as source. - */ -class Mcrypt implements Source -{ - /** - * {@inheritdoc} - */ - public static function getStrength() - { - return new Strength(Strength::MEDIUM); - } - - /** - * {@inheritdoc} - */ - public function generate($size) - { - if (! self::isSupported() || $size < 1) { - return str_repeat(chr(0), $size); - } - - return mcrypt_create_iv($size, MCRYPT_DEV_URANDOM) - ?: str_repeat(chr(0), $size); - } - - public static function isSupported(): bool - { - // Don't use the mcrypt function on http://en.wikipedia.org/wiki/Phalanger - // as /dev/[u]random is not available - return function_exists('mcrypt_create_iv') && ! defined('PHALANGER'); - } -}