[#ChainCode-GetHex]
= xref:ChainCode.adoc[ChainCode]::GetHex
:relfileprefix: ../
:mrdocs:

The hex representation used by GetHex(), ToString(), and FromHex() is unusual, since it shows bytes of the base&lowbar;blob in reverse order&period; For example, a 4&hyphen;byte blob &lcub;0x12, 0x34, 0x56, 0x78&rcub; is represented as &quot;78563412&quot; instead of the more typical &quot;12345678&quot; representation that would be shown in a hex editor or used by typical byte&hyphen;array &sol; hex conversion functions like python&apos;s bytes&period;hex() and bytes&period;fromhex()&period;

== Synopsis

Declared in `&lt;uint256&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
std::string
GetHex() const;
----

== Description

The nice thing about the reverse&hyphen;byte representation, even though it is unusual, is that if a blob contains an arithmetic number in little endian format (with least significant bytes first, and most significant bytes last), the GetHex() output will match the way the number would normally be written in base&hyphen;16 (with most significant digits first and least significant digits last)&period;

This means, for example, that ArithToUint256(num)&period;GetHex() can be used to display an arith&lowbar;uint256 num value as a number, because ArithToUint256() converts the number to a blob in little&hyphen;endian format, so the arith&lowbar;uint256 class doesn&apos;t need to have its own number parsing and formatting functions&period;

@&lcub;

Returns the blob as a hex string in reverse byte order&period;

== Return Value

The hex representation of the blob&period;


[.small]#Created with https://www.mrdocs.com[MrDocs]#
