package main | |
import ( | |
"fmt" | |
"io" | |
"os" | |
"github.com/restic/chunker" | |
) | |
func main() { | |
p, err := chunker.RandomPolynomial() | |
if err != nil { | |
panic(err) | |
} | |
fmt.Printf("using polynomial %v for splitting data\n", p) | |
chk := chunker.New(os.Stdin, p) | |
buf := make([]byte, 16*1024*1024) // 16 MiB | |
for { | |
chunk, err := chk.Next(buf) | |
if err == io.EOF { | |
break | |
} | |
if err != nil { | |
panic(err) | |
} | |
fmt.Printf("%d\t%d\t%016x\n", chunk.Start, chunk.Length, chunk.Cut) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment