All Projects → xsleonard → go-merkle

xsleonard / go-merkle

Licence: MIT license
A fixed Merkle Tree implementation in Go

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to go-merkle

pymerkletools
Python tools for creating Merkle trees, generating Merkle proofs, and verification of Merkle proofs
Stars: ✭ 128 (+255.56%)
Mutual labels:  merkle, hash, merkle-tree
merkletree
A Merkle Hash Trees implementation according to RFC 6962, written in Go.
Stars: ✭ 32 (-11.11%)
Mutual labels:  merkle, merkle-tree
Merkle Tools
Tools for creating Merkle trees, generating merkle proofs, and verification of merkle proofs.
Stars: ✭ 54 (+50%)
Mutual labels:  hash, merkle-tree
Hashapi Lib Node
Tierion Hash API client library for Node.js
Stars: ✭ 20 (-44.44%)
Mutual labels:  hash, merkle-tree
gb merkle trees
General balanced binary Merkle trees for Erlang
Stars: ✭ 25 (-30.56%)
Mutual labels:  merkle, merkle-tree
merkle
Merkle root algorithms in various languages
Stars: ✭ 40 (+11.11%)
Mutual labels:  merkle, merkle-tree
CTjs
CTjs is a full set of classes necessary to work with any kind of Certificate Transparency log (V1 as from RFC6962, or V2 as from RFC6962-bis). In CTjs you could find all necessary validation/verification functions for all related data shipped with full-featured examples showning how to validate/verify. Also in scope of CTjs I made code showing e…
Stars: ✭ 2 (-94.44%)
Mutual labels:  merkle, merkle-tree
merkle
Golang Merkle Tree Implementation. With hash.Hash interface for streaming support
Stars: ✭ 50 (+38.89%)
Mutual labels:  merkle, hash
ipld-explorer-cli
🔎 Explore the IPLD directed acyclic graph with your keyboard
Stars: ✭ 22 (-38.89%)
Mutual labels:  merkle, hash
patchmap
A fast and memory efficient hashmap using sorting to resolve collisions
Stars: ✭ 41 (+13.89%)
Mutual labels:  hash
hash-avatar
🌈 Hash avatar algorithm
Stars: ✭ 33 (-8.33%)
Mutual labels:  hash
Scrypt
A .NET implementation of scrypt password hash algorithm.
Stars: ✭ 90 (+150%)
Mutual labels:  hash
enigma
A fast, native, cryptographic engine for the web
Stars: ✭ 101 (+180.56%)
Mutual labels:  hash
xxHash-Swift
xxHash framework in Swift.
Stars: ✭ 22 (-38.89%)
Mutual labels:  hash
h2c-rust-ref
Hash to curves - Rust reference implementation
Stars: ✭ 21 (-41.67%)
Mutual labels:  hash
BlockHashLoc
Recover files using lists of blocks hashes, bypassing the File System entirely
Stars: ✭ 45 (+25%)
Mutual labels:  hash
BruteForce
A simple brute forcer written in GO for SHA1, SHA256, SHA512, MD5 and bcrypt
Stars: ✭ 49 (+36.11%)
Mutual labels:  hash
haiti
🔑 A CLI tool to identify the hash type of a given hash.
Stars: ✭ 95 (+163.89%)
Mutual labels:  hash
qed
The scalable, auditable and high-performance tamper-evident log project
Stars: ✭ 87 (+141.67%)
Mutual labels:  merkle-tree
bookshelf-secure-password
A Bookshelf.js plugin for handling secure passwords
Stars: ✭ 24 (-33.33%)
Mutual labels:  hash

go-merkle

GoDoc Travis CI

A fixed Merkle Tree implementation in Go

Example Use

package main

import (
    "crypto/sha256"
    "io/ioutil"
    "fmt"

    "github.com/xsleonard/go-merkle"
)

func splitData(data []byte, size int) [][]byte {
    /* Splits data into an array of slices of len(size) */
    count := len(data) / size
    blocks := make([][]byte, 0, count)
    for i := 0; i < count; i++ {
        block := data[i*size : (i+1)*size]
        blocks = append(blocks, block)
    }
    if len(data)%size != 0 {
        blocks = append(blocks, data[len(blocks)*size:])
    }
    return blocks
}

func main() {
    // Grab some data to make the tree out of, and partition
    data, err := ioutil.ReadFile("testdata") // assume testdata exists
    if err != nil {
        fmt.Println(err)
        return
    }
    blocks := splitData(data, 32)

    // Create & generate the tree
    tree := merkle.NewTree()
    // Create & generate the tree with sorted hashes
    // A tree with pair wise sorted hashes allows for a representation of proofs which are more space efficient
    //tree := merkle.NewTreeWithOpts(TreeOptions{EnableHashSorting: true})
    err = tree.Generate(blocks, sha256.New())
    if err != nil {
        fmt.Println(err)
        return
    }

    fmt.Printf("Height: %d\n", tree.Height())
    fmt.Printf("Root: %v\n", tree.Root())
    fmt.Printf("N Leaves: %v\n", len(tree.Leaves()))
    fmt.Printf("Height 2: %v\n", tree.GetNodesAtHeight(2))
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].