Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/clone/wp-inclu.../sodium_c.../src/Core
File: Ristretto255.php
$st = hash_init('sha512');
[500] Fix | Delete
self::hash_update($st, $ux);
[501] Fix | Delete
self::hash_update($st, self::intToChr($t[2]));
[502] Fix | Delete
self::hash_update($st, $ctx);
[503] Fix | Delete
self::hash_update($st, self::intToChr($ctx_len));
[504] Fix | Delete
$ux = hash_final($st, true);
[505] Fix | Delete
$amount = min($hLen - $i, 128);
[506] Fix | Delete
for ($j = 0; $j < $amount; ++$j) {
[507] Fix | Delete
$h[$i + $j] = self::chrToInt($ux[$i]);
[508] Fix | Delete
}
[509] Fix | Delete
}
[510] Fix | Delete
return self::intArrayToString(array_slice($h, 0, $hLen));
[511] Fix | Delete
}
[512] Fix | Delete
[513] Fix | Delete
/**
[514] Fix | Delete
* @param int $hLen
[515] Fix | Delete
* @param ?string $ctx
[516] Fix | Delete
* @param string $msg
[517] Fix | Delete
* @param int $hash_alg
[518] Fix | Delete
* @return string
[519] Fix | Delete
* @throws SodiumException
[520] Fix | Delete
*/
[521] Fix | Delete
public static function h2c_string_to_hash($hLen, $ctx, $msg, $hash_alg)
[522] Fix | Delete
{
[523] Fix | Delete
switch ($hash_alg) {
[524] Fix | Delete
case self::CORE_H2C_SHA256:
[525] Fix | Delete
return self::h2c_string_to_hash_sha256($hLen, $ctx, $msg);
[526] Fix | Delete
case self::CORE_H2C_SHA512:
[527] Fix | Delete
return self::h2c_string_to_hash_sha512($hLen, $ctx, $msg);
[528] Fix | Delete
default:
[529] Fix | Delete
throw new SodiumException('Invalid H2C hash algorithm');
[530] Fix | Delete
}
[531] Fix | Delete
}
[532] Fix | Delete
[533] Fix | Delete
/**
[534] Fix | Delete
* @param ?string $ctx
[535] Fix | Delete
* @param string $msg
[536] Fix | Delete
* @param int $hash_alg
[537] Fix | Delete
* @return string
[538] Fix | Delete
* @throws SodiumException
[539] Fix | Delete
*/
[540] Fix | Delete
protected static function _string_to_element($ctx, $msg, $hash_alg)
[541] Fix | Delete
{
[542] Fix | Delete
return self::ristretto255_from_hash(
[543] Fix | Delete
self::h2c_string_to_hash(self::crypto_core_ristretto255_HASHBYTES, $ctx, $msg, $hash_alg)
[544] Fix | Delete
);
[545] Fix | Delete
}
[546] Fix | Delete
[547] Fix | Delete
/**
[548] Fix | Delete
* @return string
[549] Fix | Delete
* @throws SodiumException
[550] Fix | Delete
* @throws Exception
[551] Fix | Delete
*/
[552] Fix | Delete
public static function ristretto255_random()
[553] Fix | Delete
{
[554] Fix | Delete
return self::ristretto255_from_hash(
[555] Fix | Delete
ParagonIE_Sodium_Compat::randombytes_buf(self::crypto_core_ristretto255_HASHBYTES)
[556] Fix | Delete
);
[557] Fix | Delete
}
[558] Fix | Delete
[559] Fix | Delete
/**
[560] Fix | Delete
* @return string
[561] Fix | Delete
* @throws SodiumException
[562] Fix | Delete
*/
[563] Fix | Delete
public static function ristretto255_scalar_random()
[564] Fix | Delete
{
[565] Fix | Delete
return self::scalar_random();
[566] Fix | Delete
}
[567] Fix | Delete
[568] Fix | Delete
/**
[569] Fix | Delete
* @param string $s
[570] Fix | Delete
* @return string
[571] Fix | Delete
* @throws SodiumException
[572] Fix | Delete
*/
[573] Fix | Delete
public static function ristretto255_scalar_complement($s)
[574] Fix | Delete
{
[575] Fix | Delete
return self::scalar_complement($s);
[576] Fix | Delete
}
[577] Fix | Delete
[578] Fix | Delete
[579] Fix | Delete
/**
[580] Fix | Delete
* @param string $s
[581] Fix | Delete
* @return string
[582] Fix | Delete
*/
[583] Fix | Delete
public static function ristretto255_scalar_invert($s)
[584] Fix | Delete
{
[585] Fix | Delete
return self::sc25519_invert($s);
[586] Fix | Delete
}
[587] Fix | Delete
[588] Fix | Delete
/**
[589] Fix | Delete
* @param string $s
[590] Fix | Delete
* @return string
[591] Fix | Delete
* @throws SodiumException
[592] Fix | Delete
*/
[593] Fix | Delete
public static function ristretto255_scalar_negate($s)
[594] Fix | Delete
{
[595] Fix | Delete
return self::scalar_negate($s);
[596] Fix | Delete
}
[597] Fix | Delete
[598] Fix | Delete
/**
[599] Fix | Delete
* @param string $x
[600] Fix | Delete
* @param string $y
[601] Fix | Delete
* @return string
[602] Fix | Delete
*/
[603] Fix | Delete
public static function ristretto255_scalar_add($x, $y)
[604] Fix | Delete
{
[605] Fix | Delete
return self::scalar_add($x, $y);
[606] Fix | Delete
}
[607] Fix | Delete
[608] Fix | Delete
/**
[609] Fix | Delete
* @param string $x
[610] Fix | Delete
* @param string $y
[611] Fix | Delete
* @return string
[612] Fix | Delete
*/
[613] Fix | Delete
public static function ristretto255_scalar_sub($x, $y)
[614] Fix | Delete
{
[615] Fix | Delete
return self::scalar_sub($x, $y);
[616] Fix | Delete
}
[617] Fix | Delete
[618] Fix | Delete
/**
[619] Fix | Delete
* @param string $x
[620] Fix | Delete
* @param string $y
[621] Fix | Delete
* @return string
[622] Fix | Delete
*/
[623] Fix | Delete
public static function ristretto255_scalar_mul($x, $y)
[624] Fix | Delete
{
[625] Fix | Delete
return self::sc25519_mul($x, $y);
[626] Fix | Delete
}
[627] Fix | Delete
[628] Fix | Delete
/**
[629] Fix | Delete
* @param string $ctx
[630] Fix | Delete
* @param string $msg
[631] Fix | Delete
* @param int $hash_alg
[632] Fix | Delete
* @return string
[633] Fix | Delete
* @throws SodiumException
[634] Fix | Delete
*/
[635] Fix | Delete
public static function ristretto255_scalar_from_string($ctx, $msg, $hash_alg)
[636] Fix | Delete
{
[637] Fix | Delete
$h = array_fill(0, 64, 0);
[638] Fix | Delete
$h_be = self::stringToIntArray(
[639] Fix | Delete
self::h2c_string_to_hash(
[640] Fix | Delete
self::HASH_SC_L, $ctx, $msg, $hash_alg
[641] Fix | Delete
)
[642] Fix | Delete
);
[643] Fix | Delete
[644] Fix | Delete
for ($i = 0; $i < self::HASH_SC_L; ++$i) {
[645] Fix | Delete
$h[$i] = $h_be[self::HASH_SC_L - 1 - $i];
[646] Fix | Delete
}
[647] Fix | Delete
return self::ristretto255_scalar_reduce(self::intArrayToString($h));
[648] Fix | Delete
}
[649] Fix | Delete
[650] Fix | Delete
/**
[651] Fix | Delete
* @param string $s
[652] Fix | Delete
* @return string
[653] Fix | Delete
*/
[654] Fix | Delete
public static function ristretto255_scalar_reduce($s)
[655] Fix | Delete
{
[656] Fix | Delete
return self::sc_reduce($s);
[657] Fix | Delete
}
[658] Fix | Delete
[659] Fix | Delete
/**
[660] Fix | Delete
* @param string $n
[661] Fix | Delete
* @param string $p
[662] Fix | Delete
* @return string
[663] Fix | Delete
* @throws SodiumException
[664] Fix | Delete
*/
[665] Fix | Delete
public static function scalarmult_ristretto255($n, $p)
[666] Fix | Delete
{
[667] Fix | Delete
if (self::strlen($n) !== 32) {
[668] Fix | Delete
throw new SodiumException('Scalar must be 32 bytes, ' . self::strlen($p) . ' given.');
[669] Fix | Delete
}
[670] Fix | Delete
if (self::strlen($p) !== 32) {
[671] Fix | Delete
throw new SodiumException('Point must be 32 bytes, ' . self::strlen($p) . ' given.');
[672] Fix | Delete
}
[673] Fix | Delete
$result = self::ristretto255_frombytes($p);
[674] Fix | Delete
if ($result['res'] !== 0) {
[675] Fix | Delete
throw new SodiumException('Could not multiply points');
[676] Fix | Delete
}
[677] Fix | Delete
$P = $result['h'];
[678] Fix | Delete
[679] Fix | Delete
$t = self::stringToIntArray($n);
[680] Fix | Delete
$t[31] &= 0x7f;
[681] Fix | Delete
$Q = self::ge_scalarmult(self::intArrayToString($t), $P);
[682] Fix | Delete
$q = self::ristretto255_p3_tobytes($Q);
[683] Fix | Delete
if (ParagonIE_Sodium_Compat::is_zero($q)) {
[684] Fix | Delete
throw new SodiumException('An unknown error has occurred');
[685] Fix | Delete
}
[686] Fix | Delete
return $q;
[687] Fix | Delete
}
[688] Fix | Delete
[689] Fix | Delete
/**
[690] Fix | Delete
* @param string $n
[691] Fix | Delete
* @return string
[692] Fix | Delete
* @throws SodiumException
[693] Fix | Delete
*/
[694] Fix | Delete
public static function scalarmult_ristretto255_base($n)
[695] Fix | Delete
{
[696] Fix | Delete
$t = self::stringToIntArray($n);
[697] Fix | Delete
$t[31] &= 0x7f;
[698] Fix | Delete
$Q = self::ge_scalarmult_base(self::intArrayToString($t));
[699] Fix | Delete
$q = self::ristretto255_p3_tobytes($Q);
[700] Fix | Delete
if (ParagonIE_Sodium_Compat::is_zero($q)) {
[701] Fix | Delete
throw new SodiumException('An unknown error has occurred');
[702] Fix | Delete
}
[703] Fix | Delete
return $q;
[704] Fix | Delete
}
[705] Fix | Delete
}
[706] Fix | Delete
[707] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function