update
This commit is contained in:
117
modules/pshowsso/vendor/paragonie/random-lib/lib/RandomLib/Mixer/Hash.php
vendored
Normal file
117
modules/pshowsso/vendor/paragonie/random-lib/lib/RandomLib/Mixer/Hash.php
vendored
Normal file
@@ -0,0 +1,117 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* The RandomLib library for securely generating random numbers and strings in PHP
|
||||
*
|
||||
* @author Anthony Ferrara <ircmaxell@ircmaxell.com>
|
||||
* @copyright 2011 The Authors
|
||||
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
||||
* @version Build @@version@@
|
||||
*/
|
||||
/**
|
||||
* The Hash medium strength mixer class
|
||||
*
|
||||
* This class implements a mixer based upon the recommendations in RFC 4086
|
||||
* section 5.2
|
||||
*
|
||||
* PHP version 5.3
|
||||
*
|
||||
* @see http://tools.ietf.org/html/rfc4086#section-5.2
|
||||
*
|
||||
* @category PHPCryptLib
|
||||
* @package Random
|
||||
* @subpackage Mixer
|
||||
*
|
||||
* @author Anthony Ferrara <ircmaxell@ircmaxell.com>
|
||||
* @copyright 2011 The Authors
|
||||
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
||||
*
|
||||
* @version Build @@version@@
|
||||
*/
|
||||
namespace RandomLib\Mixer;
|
||||
|
||||
use SecurityLib\Strength;
|
||||
use SecurityLib\Util;
|
||||
/**
|
||||
* The Hash medium strength mixer class
|
||||
*
|
||||
* This class implements a mixer based upon the recommendations in RFC 4086
|
||||
* section 5.2
|
||||
*
|
||||
* @see http://tools.ietf.org/html/rfc4086#section-5.2
|
||||
*
|
||||
* @category PHPCryptLib
|
||||
* @package Random
|
||||
* @subpackage Mixer
|
||||
*
|
||||
* @author Anthony Ferrara <ircmaxell@ircmaxell.com>
|
||||
*/
|
||||
class Hash extends \RandomLib\AbstractMixer
|
||||
{
|
||||
/**
|
||||
* @var string The hash instance to use
|
||||
*/
|
||||
protected $hash = null;
|
||||
/**
|
||||
* Build the hash mixer
|
||||
*
|
||||
* @param string $hash The hash instance to use (defaults to sha512)
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($hash = 'sha512')
|
||||
{
|
||||
$this->hash = $hash;
|
||||
}
|
||||
/**
|
||||
* Return an instance of Strength indicating the strength of the source
|
||||
*
|
||||
* @return \SecurityLib\Strength An instance of one of the strength classes
|
||||
*/
|
||||
public static function getStrength()
|
||||
{
|
||||
return new Strength(Strength::MEDIUM);
|
||||
}
|
||||
/**
|
||||
* Test to see if the mixer is available
|
||||
*
|
||||
* @return bool If the mixer is available on the system
|
||||
*/
|
||||
public static function test()
|
||||
{
|
||||
return \true;
|
||||
}
|
||||
/**
|
||||
* Get the block size (the size of the individual blocks used for the mixing)
|
||||
*
|
||||
* @return int The block size
|
||||
*/
|
||||
protected function getPartSize()
|
||||
{
|
||||
return Util::safeStrlen(hash($this->hash, '', \true));
|
||||
}
|
||||
/**
|
||||
* Mix 2 parts together using one method
|
||||
*
|
||||
* @param string $part1 The first part to mix
|
||||
* @param string $part2 The second part to mix
|
||||
*
|
||||
* @return string The mixed data
|
||||
*/
|
||||
protected function mixParts1($part1, $part2)
|
||||
{
|
||||
return hash_hmac($this->hash, $part1, $part2, \true);
|
||||
}
|
||||
/**
|
||||
* Mix 2 parts together using another different method
|
||||
*
|
||||
* @param string $part1 The first part to mix
|
||||
* @param string $part2 The second part to mix
|
||||
*
|
||||
* @return string The mixed data
|
||||
*/
|
||||
protected function mixParts2($part1, $part2)
|
||||
{
|
||||
return hash_hmac($this->hash, $part2, $part1, \true);
|
||||
}
|
||||
}
|
||||
56
modules/pshowsso/vendor/paragonie/random-lib/lib/RandomLib/Mixer/McryptRijndael128.php
vendored
Normal file
56
modules/pshowsso/vendor/paragonie/random-lib/lib/RandomLib/Mixer/McryptRijndael128.php
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* The RandomLib library for securely generating random numbers and strings in PHP
|
||||
*
|
||||
* @author Anthony Ferrara <ircmaxell@ircmaxell.com>
|
||||
* @copyright 2011 The Authors
|
||||
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
||||
* @version Build @@version@@
|
||||
*/
|
||||
/**
|
||||
* mcrypt mixer using the Rijndael cipher with 128 bit block size
|
||||
*
|
||||
* PHP version 5.3
|
||||
*
|
||||
* @category PHPCryptLib
|
||||
* @package Random
|
||||
* @subpackage Mixer
|
||||
*
|
||||
* @author Anthony Ferrara <ircmaxell@ircmaxell.com>
|
||||
* @copyright 2013 The Authors
|
||||
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
||||
*
|
||||
* @version Build @@version@@
|
||||
*/
|
||||
namespace RandomLib\Mixer;
|
||||
|
||||
use RandomLib\AbstractMcryptMixer;
|
||||
use SecurityLib\Strength;
|
||||
/**
|
||||
* mcrypt mixer using the Rijndael cipher with 128 bit block size
|
||||
*
|
||||
* @category PHPCryptLib
|
||||
* @package Random
|
||||
* @subpackage Mixer
|
||||
*
|
||||
* @author Anthony Ferrara <ircmaxell@ircmaxell.com>
|
||||
* @author Chris Smith <chris@cs278.org>
|
||||
*/
|
||||
class McryptRijndael128 extends AbstractMcryptMixer
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function getStrength()
|
||||
{
|
||||
return new Strength(Strength::HIGH);
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function getCipher()
|
||||
{
|
||||
return 'rijndael-128';
|
||||
}
|
||||
}
|
||||
93
modules/pshowsso/vendor/paragonie/random-lib/lib/RandomLib/Mixer/SodiumMixer.php
vendored
Normal file
93
modules/pshowsso/vendor/paragonie/random-lib/lib/RandomLib/Mixer/SodiumMixer.php
vendored
Normal file
@@ -0,0 +1,93 @@
|
||||
<?php
|
||||
|
||||
namespace RandomLib\Mixer;
|
||||
|
||||
use RandomLib\AbstractMixer;
|
||||
use SecurityLib\Strength;
|
||||
use SecurityLib\Util;
|
||||
/**
|
||||
* Class SodiumMixer
|
||||
*
|
||||
* @package RandomLib\Mixer
|
||||
*
|
||||
* @category PHPCryptLib
|
||||
* @package Random
|
||||
* @subpackage Mixer
|
||||
*
|
||||
* @author Paragon Initiative Enterprises <security@paragonie.com>
|
||||
* @copyright 2017 The Authors
|
||||
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
||||
*
|
||||
* @version Build @@version@@
|
||||
*/
|
||||
class SodiumMixer extends AbstractMixer
|
||||
{
|
||||
const SALSA20_BLOCK_SIZE = 64;
|
||||
/**
|
||||
* Return an instance of Strength indicating the strength of the source
|
||||
*
|
||||
* @return \SecurityLib\Strength An instance of one of the strength classes
|
||||
*/
|
||||
public static function getStrength()
|
||||
{
|
||||
return new Strength(Strength::HIGH);
|
||||
}
|
||||
/**
|
||||
* Test to see if the mixer is available
|
||||
*
|
||||
* @return bool If the mixer is available on the system
|
||||
*/
|
||||
public static function test()
|
||||
{
|
||||
return is_callable('sodium_crypto_stream') && is_callable('sodium_crypto_generichash');
|
||||
}
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public static function advisable()
|
||||
{
|
||||
return static::test() && !defined('HHVM_VERSION');
|
||||
}
|
||||
/**
|
||||
* Get the block size (the size of the individual blocks used for the mixing)
|
||||
*
|
||||
* @return int The block size
|
||||
*/
|
||||
protected function getPartSize()
|
||||
{
|
||||
return self::SALSA20_BLOCK_SIZE;
|
||||
}
|
||||
/**
|
||||
* Mix 2 parts together using one method
|
||||
*
|
||||
* This method is jut a simple BLAKE2b hash of the two strings
|
||||
* concatenated together
|
||||
*
|
||||
* @param string $part1 The first part to mix
|
||||
* @param string $part2 The second part to mix
|
||||
*
|
||||
* @return string The mixed data
|
||||
*/
|
||||
protected function mixParts1($part1, $part2)
|
||||
{
|
||||
return (string) \sodium_crypto_generichash($part1 . $part2, '', $this->getPartSize());
|
||||
}
|
||||
/**
|
||||
* Mix 2 parts together using another different method
|
||||
*
|
||||
* This method is a salsa20 stream based on a hash of the two inputs
|
||||
*
|
||||
* @param string $part1 The first part to mix
|
||||
* @param string $part2 The second part to mix
|
||||
*
|
||||
* @return string The mixed data
|
||||
*/
|
||||
protected function mixParts2($part1, $part2)
|
||||
{
|
||||
// Pre-hash the two inputs into a 448-bit output
|
||||
/** @var string $hash */
|
||||
$hash = \sodium_crypto_generichash($part1 . $part2, '', 56);
|
||||
// Use salsa20 to expand into a pseudorandom string
|
||||
return (string) \sodium_crypto_stream($this->getPartSize(), Util::safeSubstr($hash, 0, 24), Util::safeSubstr($hash, 0, 32));
|
||||
}
|
||||
}
|
||||
104
modules/pshowsso/vendor/paragonie/random-lib/lib/RandomLib/Mixer/XorMixer.php
vendored
Normal file
104
modules/pshowsso/vendor/paragonie/random-lib/lib/RandomLib/Mixer/XorMixer.php
vendored
Normal file
@@ -0,0 +1,104 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* The RandomLib library for securely generating random numbers and strings in PHP
|
||||
*
|
||||
* @author Anthony Ferrara <ircmaxell@ircmaxell.com>
|
||||
* @copyright 2011 The Authors
|
||||
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
||||
* @version Build @@version@@
|
||||
*/
|
||||
/**
|
||||
* The Hash medium strength mixer class
|
||||
*
|
||||
* This class implements a mixer based upon the recommendations in RFC 4086
|
||||
* section 5.2
|
||||
*
|
||||
* PHP version 5.3
|
||||
*
|
||||
* @see http://tools.ietf.org/html/rfc4086#section-5.2
|
||||
*
|
||||
* @category PHPCryptLib
|
||||
* @package Random
|
||||
* @subpackage Mixer
|
||||
*
|
||||
* @author Anthony Ferrara <ircmaxell@ircmaxell.com>
|
||||
* @author Paragon Initiative Enterprises <security@paragonie.com>
|
||||
* @copyright 2011 The Authors
|
||||
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
||||
*
|
||||
* @version Build @@version@@
|
||||
*/
|
||||
namespace RandomLib\Mixer;
|
||||
|
||||
use SecurityLib\Strength;
|
||||
/**
|
||||
* The Hash medium strength mixer class
|
||||
*
|
||||
* This class implements a mixer based upon the recommendations in RFC 4086
|
||||
* section 5.2
|
||||
*
|
||||
* @see http://tools.ietf.org/html/rfc4086#section-5.2
|
||||
*
|
||||
* @category PHPCryptLib
|
||||
* @package Random
|
||||
* @subpackage Mixer
|
||||
*
|
||||
* @author Anthony Ferrara <ircmaxell@ircmaxell.com>
|
||||
* @author Paragon Initiative Enterprises <security@paragonie.com>
|
||||
*/
|
||||
class XorMixer extends \RandomLib\AbstractMixer
|
||||
{
|
||||
/**
|
||||
* Return an instance of Strength indicating the strength of the source
|
||||
*
|
||||
* @return \SecurityLib\Strength An instance of one of the strength classes
|
||||
*/
|
||||
public static function getStrength()
|
||||
{
|
||||
return new Strength(Strength::VERYLOW);
|
||||
}
|
||||
/**
|
||||
* Test to see if the mixer is available
|
||||
*
|
||||
* @return bool If the mixer is available on the system
|
||||
*/
|
||||
public static function test()
|
||||
{
|
||||
return \true;
|
||||
}
|
||||
/**
|
||||
* Get the block size (the size of the individual blocks used for the mixing)
|
||||
*
|
||||
* @return int The block size
|
||||
*/
|
||||
protected function getPartSize()
|
||||
{
|
||||
return 64;
|
||||
}
|
||||
/**
|
||||
* Mix 2 parts together using one method
|
||||
*
|
||||
* @param string $part1 The first part to mix
|
||||
* @param string $part2 The second part to mix
|
||||
*
|
||||
* @return string The mixed data
|
||||
*/
|
||||
protected function mixParts1($part1, $part2)
|
||||
{
|
||||
return (string) ($part1 ^ $part2);
|
||||
}
|
||||
/**
|
||||
* Mix 2 parts together using another different method
|
||||
*
|
||||
* @param string $part1 The first part to mix
|
||||
* @param string $part2 The second part to mix
|
||||
*
|
||||
* @return string The mixed data
|
||||
*/
|
||||
protected function mixParts2($part1, $part2)
|
||||
{
|
||||
// Both mixers are identical, this is for speed, not security
|
||||
return (string) ($part1 ^ $part2);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user