pub struct AccumulateHash;Expand description
Hash utilities that match TypeScript SDK exactly
Implementations§
Source§impl AccumulateHash
impl AccumulateHash
Sourcepub fn sha256_bytes(data: &[u8]) -> [u8; 32]
pub fn sha256_bytes(data: &[u8]) -> [u8; 32]
SHA-256 hash of raw bytes Matches TS: hash(data: Uint8Array): Uint8Array
Sourcepub fn sha256_bytes_hex(data: &[u8]) -> String
pub fn sha256_bytes_hex(data: &[u8]) -> String
SHA-256 hash of raw bytes, returning hex string Matches TS: hash(data: Uint8Array): string (when hex output requested)
Sourcepub fn sha256_json(value: &Value) -> [u8; 32]
pub fn sha256_json(value: &Value) -> [u8; 32]
SHA-256 hash of canonical JSON Matches TS: hashJson(obj: any): Uint8Array
Sourcepub fn sha256_json_hex(value: &Value) -> String
pub fn sha256_json_hex(value: &Value) -> String
SHA-256 hash of canonical JSON, returning hex string Matches TS: hashJson(obj: any): string (when hex output requested)
Sourcepub fn sha256_string(text: &str) -> [u8; 32]
pub fn sha256_string(text: &str) -> [u8; 32]
Hash a string as UTF-8 bytes Matches TS: hashString(str: string): Uint8Array
Sourcepub fn sha256_string_hex(text: &str) -> String
pub fn sha256_string_hex(text: &str) -> String
Hash a string as UTF-8 bytes, returning hex string Matches TS: hashString(str: string): string (when hex output requested)
Sourcepub fn sha256_concat(arrays: &[&[u8]]) -> [u8; 32]
pub fn sha256_concat(arrays: &[&[u8]]) -> [u8; 32]
Hash multiple byte arrays concatenated Matches TS: hashConcat(…arrays: Uint8Array[]): Uint8Array
Sourcepub fn sha256_concat_hex(arrays: &[&[u8]]) -> String
pub fn sha256_concat_hex(arrays: &[&[u8]]) -> String
Hash multiple byte arrays concatenated, returning hex string Matches TS: hashConcat(…arrays: Uint8Array[]): string (when hex output requested)
Sourcepub fn double_sha256(data: &[u8]) -> [u8; 32]
pub fn double_sha256(data: &[u8]) -> [u8; 32]
Double SHA-256 hash (hash of hash) Matches TS: doubleHash(data: Uint8Array): Uint8Array
Sourcepub fn double_sha256_hex(data: &[u8]) -> String
pub fn double_sha256_hex(data: &[u8]) -> String
Double SHA-256 hash, returning hex string Matches TS: doubleHash(data: Uint8Array): string (when hex output requested)
Sourcepub fn sha256_binary_encoded<T>(
value: T,
field: Option<u32>,
) -> Result<[u8; 32], EncodingError>where
T: BinaryEncodable,
pub fn sha256_binary_encoded<T>(
value: T,
field: Option<u32>,
) -> Result<[u8; 32], EncodingError>where
T: BinaryEncodable,
Hash using binary encoding first Matches TS: hashBinaryEncoded(value: any, field?: number): Uint8Array
Sourcepub fn sha256_binary_encoded_hex<T>(
value: T,
field: Option<u32>,
) -> Result<String, EncodingError>where
T: BinaryEncodable,
pub fn sha256_binary_encoded_hex<T>(
value: T,
field: Option<u32>,
) -> Result<String, EncodingError>where
T: BinaryEncodable,
Hash using binary encoding first, returning hex string Matches TS: hashBinaryEncoded(value: any, field?: number): string (when hex output requested)
Sourcepub fn hash_transaction(transaction: &Value) -> [u8; 32]
pub fn hash_transaction(transaction: &Value) -> [u8; 32]
Hash a transaction using canonical JSON (matches TS SDK exactly) This is the primary method for transaction hashing in Accumulate
Sourcepub fn hash_transaction_hex(transaction: &Value) -> String
pub fn hash_transaction_hex(transaction: &Value) -> String
Hash a transaction using canonical JSON, returning hex string
Trait Implementations§
Source§impl Clone for AccumulateHash
impl Clone for AccumulateHash
Source§fn clone(&self) -> AccumulateHash
fn clone(&self) -> AccumulateHash
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more