aboutsummaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/lib.rs b/src/lib.rs
index d64e18f..e6a9d67 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -219,7 +219,12 @@ fn counter_high(counter: u64) -> u32 {
#[cfg_attr(feature = "zeroize", derive(zeroize::Zeroize))]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
#[derive(Clone, Copy, Hash)]
-pub struct Hash([u8; OUT_LEN]);
+pub struct Hash(
+ #[rustfmt::skip]
+ // In formats like CBOR, bytestrings are more compact than lists of ints.
+ #[cfg_attr(feature = "serde", serde(with = "serde_bytes"))]
+ [u8; OUT_LEN],
+);
impl Hash {
/// The raw bytes of the `Hash`. Note that byte arrays don't provide