Skip to content
This repository has been archived by the owner on Apr 13, 2024. It is now read-only.

mavenor/sealdir

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

60 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

sealdir

A C++ library and CLI tool ๐Ÿ”ง to seal a directoryโ€™s state ๐Ÿ“ฆ ๐Ÿ“จ. In essence, gets the hash of a directory.
Currently barely stable, and far from how I'd imagined it.

While that technically doesnโ€™t mean one specific thing (capable of being interpreted and/or implemented in different ways), here it means recursively hashing its contents using a tree structure. Including the metadata of each dir-tree node as well, this โ€œstampโ€ hash that is thus calculated should make it very hard for a directory to be tampered with secretly.

Itโ€™s been done before โ€” hash-trees (also โ€œMerkle treesโ€ after their creator Ralph C. Merkle) of directories are used in the BitTorrent protocol ๐Ÿ“ฅ, macOS SSV, and git ๐ŸŽ‹โŒฅ itself.

But this project aims at making a near-standalone library (as well as an exemplifying frontend CLT) available, for any other great ideas yet unimplemented to gain a head-start.

documentation coming soon (once the library gets big enough โ€” if it gets big enough)

Build Requirements

Relies on the GnuPG projectโ€™s crypto library (libgcrypt) for all the hashing work.

  1. Ensure that libgcrypt (โ‰ฅ v1.8.7) is installed on your system. If youโ€™re on linux, you can probably skip this step. For other platforms, the easiest way is often to get GnuPG itself. There are several binaries suggested by GnuPG here.
  2. Ensure your compiler and linker have access to libgcryptโ€™s headers and object-libraries. You can find out what flags to pass to your compiler by running libgcrypt-config --cflags --libs, once you have ensured that libgcrypt is installed.
  3. Build!
    • macOS (requires Xcode CLT or a separate installation of clang or gcc):
      clang++ -dylib -std=gnu++17 ./src/* -o libsealdir.dylib
    • Linux:
      g++ -flinker-output=dyn -std=gnu++17 ./src/* -o libsealdir.so

N.B.: libgcrypt is distributed under the GNU GPL v3, which has different terms and distribution-restrictions from the BSD โ€œ3-Clauseโ€ license used in the rest of this software.

About

A C++ library & CLI tool ๐Ÿ›  to seal the state of a directory ๐Ÿ“ฆ๐Ÿ”’ (think checksums, but for a directory)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Languages