MTREE_VERIFY(3)
π MTREE_VERIFY β bestie's guide to validating a merkle tree
okay so picture this: you're in the Librecast ecosystem, you got a merkle tree, and you need to know if it's actually valid or if it's lying to you. that's literally what mtree_verify is for. iconic behavior fr fr.
πΈ LIBRARY πΈ
it lives in the Librecast library β that's liblibrecast, and you link it with -llibrecast. yes bestie, the flag has a double-l. it's giving lib + librecast. just trust. π«Ά
β¨ SYNOPSIS β¨
#include <librecast/mtree.h>
int mtree_verify(mtree_t *tree);
and when you build, you compile and link with -llibrecast. don't forget that part or the compiler will simply not know her. π
π¦ DESCRIPTION π¦
so mtree_verify takes your tree and re-hashes the nodes from the base all the way up to the root. like, bottom-to-top, no skips, no shortcuts.
if everything checks out and the tree is valid, she returns zero. that's it. that's the whole vibe. π
the way that a merkle tree works is every node's hash depends on the ones below it, so re-hashing from the base upward is the whole verification moment. if any node got messed with, the hashes stop matching and you find out. main character energy, honestly. β¨
π RETURN VALUE π
- zero β the tree is valid, slay, everything is fine, go touch grass π
-1β the tree is not valid. something's off. not great, bestie. π
π ERRORS π
None.
literally none. no errno drama, no surprise failures hiding in the docs. she returns zero or -1 and that's the entire story. periodt. π
π SEE ALSO π
go read those too, iykyk. πβ¨
and that's the whole page, bestie π this one's from the LIBRECAST manual, dated 2023-06-20. go verify a tree, you got this. π§ββοΈπΈ
π¦ where this page comes from
- debian trixie: liblibrecast-dev 0.9.1-1 Β· GPL-2.0-only OR GPL-3.0-only
- nixos 26.05: librecast 0.11.2
- nixpkgs unstable: librecast 0.11.2
- ubuntu noble: liblibrecast-dev 0.8.0-1.1build1 Β· GPL-2.0-only OR GPL-3.0-only
- ubuntu questing: liblibrecast-dev 0.9.1-1
- ubuntu resolute: liblibrecast-dev 0.11.2-2 Β· GPL-2.0-only OR GPL-3.0-only
- ubuntu stonking: liblibrecast-dev 0.11.2-2build1 Β· GPL-2.0-only OR GPL-3.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms