From 3341bd0e945341528033ec6ebaef4f611f654ebe Mon Sep 17 00:00:00 2001 From: axtloss Date: Wed, 28 Feb 2024 23:42:26 +0100 Subject: restructure repository layout --- core/crypt.go | 27 --------------------------- 1 file changed, 27 deletions(-) delete mode 100644 core/crypt.go (limited to 'core/crypt.go') 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 -} -- cgit v1.2.3