From e6c12b02674a04ca34e27b46f6ca3261fca3c677 Mon Sep 17 00:00:00 2001 From: axtloss Date: Sun, 18 Feb 2024 01:19:58 +0100 Subject: Add comments and function descriptions --- verifysetup/core/crypt.go | 3 +++ 1 file changed, 3 insertions(+) (limited to 'verifysetup/core/crypt.go') diff --git a/verifysetup/core/crypt.go b/verifysetup/core/crypt.go index 4658641..1307bd3 100644 --- a/verifysetup/core/crypt.go +++ b/verifysetup/core/crypt.go @@ -11,6 +11,7 @@ import ( "strings" ) +// CalculateBlockHash calculates the sha1 checksum of a byte slice. func CalculateBlockHash(block []byte) (string, error) { hash := sha1.New() if _, err := io.Copy(hash, bytes.NewReader(block)); err != nil { @@ -20,6 +21,8 @@ func CalculateBlockHash(block []byte) (string, error) { return strings.TrimSpace(fmt.Sprintf("%x", hashInBytes)), nil } +// SignDatabase generates a minisign signature of the database using given keys. +// The minisign signature uses "fsverify" as the comments to ensure predictability when fsverify verifies the signature. func SignDatabase(database string, minisignKeys string) ([]byte, error) { fmt.Print("Enter your password (will not echo): ") p, err := term.ReadPassword(int(os.Stdin.Fd())) -- cgit v1.2.3