Ether Binder
Set of utilities for interacting with Ethereum and it's smart contracts with PHP, with generating ABI bindings and Ethereum-related types
Loading...
Searching...
No Matches
M8B\EtherBinder\Common\Hash Class Reference
Inheritance diagram for M8B\EtherBinder\Common\Hash:
M8B\EtherBinder\Common\BinarySerializableInterface M8B\EtherBinder\Common\HashSerializable M8B\EtherBinder\Common\Address M8B\EtherBinder\Common\BlockNonce M8B\EtherBinder\Common\Bloom M8B\EtherBinder\Common\SolidityFunction4BytesSignature

Public Member Functions

 toHex (bool $with0x=true)
 
 toBin ()
 
 eq (Hash $b)
 
 isNull ()
 
 toHex ()
 
 toHex ()
 

Static Public Member Functions

static fromHex (string $hex)
 
static fromBin (string $bin)
 
static NULL ()
 

Protected Attributes

const dataSizeBytes = 32
 
string $bytes
 

Detailed Description

Hash is a class for representing Ethereum hashes and sets structure and method for another single value data types such as Ethereum Address.

Author
DubbaThony

Member Function Documentation

◆ eq()

M8B\EtherBinder\Common\Hash::eq ( Hash $b)

Checks for equality with another Hash or Hash-derivative object.

Parameters
static$bAnother object to compare against.
Returns
bool True if equal, false otherwise.

◆ fromBin()

static M8B\EtherBinder\Common\Hash::fromBin ( string $bin)
static

Initializes from a binary string.

Parameters
string$binBinary data.
Returns
static
Exceptions
InvalidLengthException

Implements M8B\EtherBinder\Common\BinarySerializableInterface.

◆ fromHex()

static M8B\EtherBinder\Common\Hash::fromHex ( string $hex)
static

Initializes from a hexadecimal string.

Parameters
string$hexHexadecimal data.
Returns
static
Exceptions
InvalidHexLengthException
InvalidHexException

Implements M8B\EtherBinder\Common\BinarySerializableInterface.

Reimplemented in M8B\EtherBinder\Common\Address.

◆ isNull()

M8B\EtherBinder\Common\Hash::isNull ( )

Checks if inner data contains only zeroes (equals to static::NULL())

Returns
bool true if inner data is null data, false otherwise

◆ NULL()

static M8B\EtherBinder\Common\Hash::NULL ( )
static

Initializes object with all zeros.

Returns
static The null object.

◆ toBin()

M8B\EtherBinder\Common\Hash::toBin ( )

Converts the internal data into to a binary string.

Returns
string Binary representation.

Implements M8B\EtherBinder\Common\BinarySerializableInterface.

◆ toHex() [1/3]

M8B\EtherBinder\Common\BinarySerializableInterface::toHex ( )
inherited

◆ toHex() [2/3]

M8B\EtherBinder\Common\Hash::toHex ( bool $with0x = true)

Converts the internal data into to a hexadecimal string.

Parameters
bool$with0xFlag to include "0x" prefix or not.
Returns
string Hexadecimal representation.

◆ toHex() [3/3]

M8B\EtherBinder\Common\HashSerializable::toHex ( )
inherited

Implemented in M8B\EtherBinder\Utils\OOGmp.


The documentation for this class was generated from the following file: