Import bzzhash from bzz-fefe branch

This commit is contained in:
Daniel A. Nagy 2015-02-01 14:38:38 +01:00
parent 927fcc7acf
commit 463b056518

28
bzz/bzzhash/bzzhash.go Normal file
View file

@ -0,0 +1,28 @@
// bzzhash
package main
import (
"fmt"
"github.com/ethereum/go-ethereum/bzz"
"io"
"os"
)
func main() {
if len(os.Args) < 2 {
fmt.Println("Usage: bzzhash <file name>")
os.Exit(0)
}
f, err := os.Open(os.Args[1])
if err != nil {
fmt.Println("Error opening file " + os.Args[1])
os.Exit(1)
}
stat, _ := f.Stat()
sr := io.NewSectionReader(f, 0, stat.Size())
hash := bzz.GetDPAhash(sr, nil)
fmt.Printf("%064x\n", hash)
}