mirror of
https://github.com/arnaucube/miden-crypto.git
synced 2026-01-10 16:11:30 +01:00
feat: add to_hex() to RpoDigest and RpxDigest
This commit is contained in:
committed by
Bobbin Threadbare
parent
c9ab3beccc
commit
7e9d4a4316
@@ -33,6 +33,11 @@ impl RpoDigest {
|
|||||||
{
|
{
|
||||||
digests.flat_map(|d| d.0.iter())
|
digests.flat_map(|d| d.0.iter())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns hexadecimal representation of this digest prefixed with `0x`.
|
||||||
|
pub fn to_hex(&self) -> String {
|
||||||
|
bytes_to_hex_string(self.as_bytes())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Digest for RpoDigest {
|
impl Digest for RpoDigest {
|
||||||
@@ -158,7 +163,7 @@ impl From<RpoDigest> for [u8; DIGEST_BYTES] {
|
|||||||
impl From<RpoDigest> for String {
|
impl From<RpoDigest> for String {
|
||||||
/// The returned string starts with `0x`.
|
/// The returned string starts with `0x`.
|
||||||
fn from(value: RpoDigest) -> Self {
|
fn from(value: RpoDigest) -> Self {
|
||||||
bytes_to_hex_string(value.as_bytes())
|
value.to_hex()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,11 @@ impl RpxDigest {
|
|||||||
{
|
{
|
||||||
digests.flat_map(|d| d.0.iter())
|
digests.flat_map(|d| d.0.iter())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns hexadecimal representation of this digest prefixed with `0x`.
|
||||||
|
pub fn to_hex(&self) -> String {
|
||||||
|
bytes_to_hex_string(self.as_bytes())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Digest for RpxDigest {
|
impl Digest for RpxDigest {
|
||||||
@@ -158,7 +163,7 @@ impl From<RpxDigest> for [u8; DIGEST_BYTES] {
|
|||||||
impl From<RpxDigest> for String {
|
impl From<RpxDigest> for String {
|
||||||
/// The returned string starts with `0x`.
|
/// The returned string starts with `0x`.
|
||||||
fn from(value: RpxDigest) -> Self {
|
fn from(value: RpxDigest) -> Self {
|
||||||
bytes_to_hex_string(value.as_bytes())
|
value.to_hex()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user