-
-
Save fd0/a74e42a7a4f51c4ccaa6c11a09c14619 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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