diff --git a/src/lib.rs b/src/lib.rs index c793e0b..2e4a1a2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -324,6 +324,21 @@ impl From for Message { } } +impl fmt::LowerHex for Message { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + for byte in self.0.iter() { + write!(f, "{:02x}", byte)?; + } + Ok(()) + } +} + +impl fmt::Display for Message { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::LowerHex::fmt(self, f) + } +} + /// An ECDSA error #[derive(Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Debug)] pub enum Error {