From 613ea3dffa40f6d3009ef5899d3497a497e1dc1c Mon Sep 17 00:00:00 2001 From: Marek Siarkowicz Date: Fri, 27 Jan 2023 15:06:56 +0100 Subject: [PATCH] Add support for using sha256 sum for obfuscating values Signed-off-by: Marek Siarkowicz --- cmd/bbolt/main.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmd/bbolt/main.go b/cmd/bbolt/main.go index 809e36181..345dfedd0 100644 --- a/cmd/bbolt/main.go +++ b/cmd/bbolt/main.go @@ -2,6 +2,7 @@ package main import ( "bytes" + "crypto/sha256" "encoding/binary" "encoding/hex" "errors" @@ -535,7 +536,7 @@ func formatBytes(b []byte, format string) (string, error) { case "auto": return bytesToAsciiOrHex(b), nil case "redacted": - return fmt.Sprintf("", len(b)), nil + return fmt.Sprintf("", len(b), sha256.New().Sum(b)), nil default: return "", fmt.Errorf("formatBytes: unsupported format: %s", format) }