Skip to content

Commit

Permalink
🚿
Browse files Browse the repository at this point in the history
  • Loading branch information
codemasher committed Mar 6, 2024
1 parent dfaef9f commit cedcf84
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/Common/Base64.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class Base64{
public static function encode(#[SensitiveParameter] string $str):string{

if(function_exists('sodium_bin2base64')){
return sodium_bin2base64($str, \SODIUM_BASE64_VARIANT_ORIGINAL);
return \sodium_bin2base64($str, \SODIUM_BASE64_VARIANT_ORIGINAL);
}

return ConstantTimeBase64::encode($str);
Expand All @@ -50,7 +50,7 @@ public static function decode(#[SensitiveParameter] string $base64):string{
self::checkCharacterSet($base64);

if(function_exists('sodium_base642bin')){
return sodium_base642bin($base64, \SODIUM_BASE64_VARIANT_ORIGINAL);
return \sodium_base642bin($base64, \SODIUM_BASE64_VARIANT_ORIGINAL);
}

return ConstantTimeBase64::decode($base64);
Expand Down
8 changes: 4 additions & 4 deletions src/Common/Hex.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,29 +28,29 @@ class Hex{
public const CHARSET = '1234567890ABCDEFabcdef';

/**
* Encode a raw-binary to hexadecimal
* Encode a string to hexadecimal
*
* @codeCoverageIgnore
*/
public static function encode(#[SensitiveParameter] string $str):string{

if(function_exists('sodium_bin2hex')){
return sodium_bin2hex($str);
return \sodium_bin2hex($str);
}

return ConstantTimeHex::encode($str);
}

/**
* Decode a raw-binary string from hexadecimal
* Decode a string from hexadecimal
*
* @codeCoverageIgnore
*/
public static function decode(#[SensitiveParameter] string $hex):string{
self::checkCharacterSet($hex);

if(function_exists('sodium_hex2bin')){
return sodium_hex2bin($hex);
return \sodium_hex2bin($hex);
}

return ConstantTimeHex::decode($hex);
Expand Down

0 comments on commit cedcf84

Please sign in to comment.