diff options
author | axtloss <axtlos@getcryst.al> | 2024-02-28 23:42:26 +0100 |
---|---|---|
committer | axtloss <axtlos@getcryst.al> | 2024-02-28 23:42:26 +0100 |
commit | 3341bd0e945341528033ec6ebaef4f611f654ebe (patch) | |
tree | f82d4557ac097d08583e56152352cbd5abd335ea /core/crypt.go | |
parent | 91d58f9ae9e9d9adc2e19a0b56d2b9757f6696d6 (diff) | |
download | fsverify-3341bd0e945341528033ec6ebaef4f611f654ebe.tar.gz fsverify-3341bd0e945341528033ec6ebaef4f611f654ebe.tar.bz2 |
restructure repository layout
Diffstat (limited to 'core/crypt.go')
-rw-r--r-- | core/crypt.go | 27 |
1 files changed, 0 insertions, 27 deletions
diff --git a/core/crypt.go b/core/crypt.go deleted file mode 100644 index 067a0b3..0000000 --- a/core/crypt.go +++ /dev/null @@ -1,27 +0,0 @@ -package core - -import ( - "bytes" - "crypto/sha1" - "fmt" - "io" - "strings" -) - -// calculateStringHash calculates the sha1 checksum of a given string a. -func calculateStringHash(a string) (string, error) { - hash := sha1.New() - hash.Write([]byte(a)) - hashInBytes := hash.Sum(nil)[:20] - return strings.TrimSpace(fmt.Sprintf("%x", hashInBytes)), nil -} - -// CalculateBlockHash calculates the sha1 checksum of a given byte slice b. -func CalculateBlockHash(b []byte) (string, error) { - hash := sha1.New() - if _, err := io.Copy(hash, bytes.NewReader(b)); err != nil { - return "", err - } - hashInBytes := hash.Sum(nil)[:20] - return strings.TrimSpace(fmt.Sprintf("%x", hashInBytes)), nil -} |