diff options
Diffstat (limited to 'commons')
-rw-r--r-- | commons/hash.go | 17 | ||||
-rw-r--r-- | commons/hash_test.go | 12 |
2 files changed, 0 insertions, 29 deletions
diff --git a/commons/hash.go b/commons/hash.go deleted file mode 100644 index 03fa53f..0000000 --- a/commons/hash.go +++ /dev/null @@ -1,17 +0,0 @@ -package commons - -import ( - "crypto/sha1" - "fmt" - "strconv" -) - -func GitHash(t string, b []byte) string { - h := []byte(t) - h = append(h, ' ') - h = strconv.AppendInt(h, int64(len(b)), 10) - h = append(h, 0) - h = append(h, b...) - - return fmt.Sprintf("%x", sha1.Sum(h)) -} diff --git a/commons/hash_test.go b/commons/hash_test.go deleted file mode 100644 index 79a22ea..0000000 --- a/commons/hash_test.go +++ /dev/null @@ -1,12 +0,0 @@ -package commons - -import ( - "testing" - - "github.com/stretchr/testify/assert" -) - -func TestCalculateHash(t *testing.T) { - assert.Equal(t, "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", GitHash("blob", []byte(""))) - assert.Equal(t, "8ab686eafeb1f44702738c8b0f24f2567c36da6d", GitHash("blob", []byte("Hello, World!\n"))) -} |