Skip to content

Commit

Permalink
Add support for using sha256 sum for obfuscating values
Browse files Browse the repository at this point in the history
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
  • Loading branch information
serathius authored and ahrtr committed Jan 27, 2023
1 parent 6ee9f1d commit 613ea3d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cmd/bbolt/main.go
Expand Up @@ -2,6 +2,7 @@ package main

import (
"bytes"
"crypto/sha256"
"encoding/binary"
"encoding/hex"
"errors"
Expand Down Expand Up @@ -535,7 +536,7 @@ func formatBytes(b []byte, format string) (string, error) {
case "auto":
return bytesToAsciiOrHex(b), nil
case "redacted":
return fmt.Sprintf("<redacted len:%d>", len(b)), nil
return fmt.Sprintf("<redacted len:%d sha256:%x>", len(b), sha256.New().Sum(b)), nil
default:
return "", fmt.Errorf("formatBytes: unsupported format: %s", format)
}
Expand Down

0 comments on commit 613ea3d

Please sign in to comment.