diff options
author | axtloss <axtlos@getcryst.al> | 2024-02-18 01:19:58 +0100 |
---|---|---|
committer | axtloss <axtlos@getcryst.al> | 2024-02-18 01:19:58 +0100 |
commit | e6c12b02674a04ca34e27b46f6ca3261fca3c677 (patch) | |
tree | 0d5d785428436bf3fcc751eb8e2be4ca0b3bfe04 /verifysetup/core/crypt.go | |
parent | 6a3db4c72485aba6187466005473e287f539e3ce (diff) | |
download | fsverify-e6c12b02674a04ca34e27b46f6ca3261fca3c677.tar.gz fsverify-e6c12b02674a04ca34e27b46f6ca3261fca3c677.tar.bz2 |
Add comments and function descriptions
Diffstat (limited to '')
-rw-r--r-- | verifysetup/core/crypt.go | 3 |
1 files changed, 3 insertions, 0 deletions
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())) |