merklehash

command module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 6, 2020 License: GPL-3.0 Imports: 11 Imported by: 0

README

merklehash

A go implementation of a merkle tree for hashing arbitrary sized directories.

Caution should be exercised when hashing directories with large files or large quantities of files as it could take some time. Should a platform support recursive symlinks one must be careful to ensure they do not exist within the directory being hashed as it'll result in an infinite loop.

Install

go get "github.com/chrisdoherty4/merklehash"
go install "github.com/chrisdoherty4/merklehash"

merklehash <directory>

API

The merkletree package exposes a single function, New(). The function accepts a context.Context that can be cancelled by the caller as desired.

Example
package main

import "github.com/chrisdoherty4/merklehash/merkletree"

func main() {
  path := "/directory/to/hash"
  hash, _ := merkletree.New(context.Background(), path, sha256.New)

  fmt.Printf("%x\n", hash)
}

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL