aboutsummaryrefslogtreecommitdiffhomepage
path: root/cmd/mbf
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/mbf')
-rw-r--r--cmd/mbf/main.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/cmd/mbf/main.go b/cmd/mbf/main.go
index 41735646..74b1bd7f 100644
--- a/cmd/mbf/main.go
+++ b/cmd/mbf/main.go
@@ -14,6 +14,7 @@ package main
import (
"context"
+ "crypto/sha512"
"errors"
"fmt"
"io"
@@ -126,6 +127,19 @@ func main() {
"abstract UNIX sockets",
)
+ c.NewCommand(
+ "checksum", "Compute checksum of data read from standard input",
+ func([]string) error {
+ go func() { <-ctx.Done(); os.Exit(1) }()
+ h := sha512.New384()
+ if _, err := io.Copy(h, os.Stdin); err != nil {
+ return err
+ }
+ log.Println(pkg.Encode(pkg.Checksum(h.Sum(nil))))
+ return nil
+ },
+ )
+
{
var flagShifts int
c.NewCommand(