Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions internal/pkg/crypto/sha.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package crypto

import (
"crypto/sha1"
"crypto/sha512"
"fmt"
"io"

Expand All @@ -10,7 +10,7 @@ import (

// GenerateSHA generates SHA from string
func GenerateSHA(data string) string {
hasher := sha1.New()
hasher := sha512.New()
_, err := io.WriteString(hasher, data)
if err != nil {
logrus.Errorf("Unable to write data in hash writer %v", err)
Expand Down
2 changes: 1 addition & 1 deletion internal/pkg/crypto/sha_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
// TestGenerateSHA generates the sha from given data and verifies whether it is correct or not
func TestGenerateSHA(t *testing.T) {
data := "www.stakater.com"
sha := "abd4ed82fb04548388a6cf3c339fd9dc84d275df"
sha := "f9c4c51315e9ad36ec77279db875ab3f1d854b9deb77dabf7eb874427c36c2f12ab409318d3afd3e029a10913f18c0ca098a1e674fe914c5d8841f14e31542b3"
result := GenerateSHA(data)
if result != sha {
t.Errorf("Failed to generate SHA")
Expand Down