Utils class

Framework\Crypto\Utils

Class Utils.

Defined in libraries/crypto/src/Utils.php

Methods #

base642bin()
Converts a base64 string to binary.
bin2base64()
Converts a binary string to base64.
bin2hex()
Converts a binary string to hexadecimal.
hex2bin()
Converts a hexadecimal string to binary.

base642bin()

public static function base642bin(string $string, int $id = 1, string $ignore = ''): string

Converts a base64 string to binary.

Parameters
  • string $string
  • int $id
  • string $ignore
Returns string - The binary string
throws
SodiumException

bin2base64()

public static function bin2base64(string $string, int $id = 1): string

Converts a binary string to base64.

Parameters
  • string $string
  • int $id
Returns string - The base64 encoded string
throws
SodiumException

bin2hex()

public static function bin2hex(string $string): string

Converts a binary string to hexadecimal.

Parameters
  • string $string
Returns string - The hexadecimal string
throws
SodiumException

hex2bin()

public static function hex2bin(string $string, string $ignore = ''): string

Converts a hexadecimal string to binary.

Parameters
  • string $string
  • string $ignore
Returns string - The binary string
throws
SodiumException