Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
fuelphp 1.8.1 error : hex2bin() only expects hexadecimal characters
  • i move my app  to 1.8.1
    I got this error when using
    Crypt::encode("anything", 'R@nd0mK~Y')

    my config/crypt.php looks like :

    ...
    'sodium' =>
    array(
    'cipherkey' => '2235d0eb55e72d0d60e6cebdb08168be4ce7f9502cc3faca0f8f7c1907f46ff6',
    ),
    ...

    here is the full error :

    hex2bin() only expects hexadecimal characters
    VENDORPATH/paragonie/sodium_compat/src/Core/Util.php @ line 343
        VENDORPATH/paragonie/sodium_compat/src/Compat.php @ line 2472
    VENDORPATH/paragonie/sodium_compat/lib/php72compat.php @ line 944
    COREPATH/classes/crypt.php @ line 481
    COREPATH/classes/crypt.php @ line 153
    APPPATH/views/chatbox/settings.php @ line 145
    APPPATH/views/chatbox/settings.php @ line 145
    COREPATH/classes/view.php @ line 258
    COREPATH/classes/view.php @ line 274
    COREPATH/classes/view.php @ line 680
    COREPATH/classes/view.php @ line 227
    COREPATH/classes/response.php @ line 382
    DOCROOT/index.php @ line 117
  • Odd.

    Do you have the correct versions of everything? You updated the composer files in your app as well, and ran a "composer update"?

    I can't reproduce it:

    [wanwizard@catwoman] $ php -a
    Interactive shell

    php > require('/var/www/fuelphp/1.9deve/fuel/vendor/paragonie/sodium_compat/src/Core/Util.php');
    php > $x = ParagonIE_Sodium_Core_Util::hex2bin('2235d0eb55e72d0d60e6cebdb08168be4ce7f9502cc3faca0f8f7c1907f46ff6');
    php > 

    doesn't throw an error here?
  • i was using it as default with "R@nd0mK~Y" (ofcourse i was going to change it later)

    ParagonIE_Sodium_Core_Util::hex2bin('2235d0eb55e72d0d60e6cebdb08168be4ce7f9502cc3faca0f8f7c1907f46ff6');

    doesn't throw error for me as well

    $x = ParagonIE_Sodium_Core_Util::hex2bin('R@nd0mK~Y');
    Warning: Uncaught exception 'RangeException' with message 'hex2bin() only expects hexadecimal characters'
    Warning: Uncaught exception 'RangeException' with message 'hex2bin() only expects hexadecimal characters' in /var/www/html/chatbox/fuel/vendor/paragonie/sodium_compat/src/Core/Util.php:343

  • The cipherkey is a hexadecimal string, what gave you the idea that your value would work?

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion