From 9cd2af6cec89f6a70617ac71cb5e8f09efe6d8dc Mon Sep 17 00:00:00 2001 From: Dmitriy Ryajov Date: Mon, 23 Oct 2023 19:39:47 -0600 Subject: [PATCH] get digest bytes --- codex/utils/digest.nim | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 codex/utils/digest.nim diff --git a/codex/utils/digest.nim b/codex/utils/digest.nim new file mode 100644 index 00000000..a33a769d --- /dev/null +++ b/codex/utils/digest.nim @@ -0,0 +1,7 @@ +import pkg/libp2p/multihash + +template bytes*(mh: MultiHash): seq[byte] = + ## get the hash bytes of a multihash object + ## + + mh.data.buffer[mh.dpos..(mh.dpos + mh.size - 1)]