Overview
KB
Technical FAQ
PHP Manual
CSS2 Manual
HTML Manual
JS Guide
JS Reference
PhpDock Manual
Nu-Coder Manual
PhpExpress Manual
PHP Joomla
Development
Learn PHP
 
<sodium_bin2base64sodium_compare>
^Sodium FunctionsLast updated: Mon, 26 Oct 2026

sodium_bin2hex

(PHP 7 >= 7.2.0, PHP 8)

sodium_bin2hex — Encode to hexadecimal

Description

function sodium_bin2hex(#[\SensitiveParameter] string $string): string

Converts a raw binary string into a hex-encoded string. Unlike the standard hex-encoding function, sodium_bin2hex() is constant-time (a property that is important for any code that touches cryptographic inputs, such as plaintexts or keys).

Parameters

string

Raw binary string.

Return Values

Hex encoded string.


<sodium_bin2base64sodium_compare>
^Sodium FunctionsLast updated: Mon, 26 Oct 2026