Hash
in package
SHA-256 hash utility for Stellar operations
Provides cryptographic hash functions commonly used throughout the Stellar SDK, particularly for transaction hashing, signature verification, and data integrity checks.
Example:
// Generate raw binary hash
$binaryHash = Hash::generate("data to hash");
// Generate hexadecimal string hash
$hexHash = Hash::asString("data to hash");
echo $hexHash; // Outputs 64-character hex string
Tags
Table of Contents
Methods
- asString() : string
- Returns a string representation of the sha-256 hash of $data
- generate() : string
- Returns the raw bytes of a sha-256 hash of $data
Methods
asString()
Returns a string representation of the sha-256 hash of $data
public
static asString(string $data) : string
Parameters
- $data : string
-
The data to hash
Tags
Return values
string —Hexadecimal string representation of the hash (64 characters)
generate()
Returns the raw bytes of a sha-256 hash of $data
public
static generate(string $data) : string
Parameters
- $data : string
-
The data to hash
Tags
Return values
string —Raw binary hash output (32 bytes)