Skip to content

Commit

Permalink
Merge pull request #3 from Eclalang/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
Axou89 authored Feb 26, 2024
2 parents 64b0e5c + dd4fb28 commit 9ad4bf5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## HASH LIBRARY FOR ECLA
# Hash library

# Candidate functions :
## Candidate functions :

| Func Name | Prototype | Description | Comments |
|:---------------:|:------------------------------------:|:---------------------------------------:|:--------:|
Expand Down
19 changes: 9 additions & 10 deletions hashlibtest/hash_test.go → hash_test.go
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
package hashlibtest
package hash

import (
"crypto/md5"
"crypto/sha1"
"crypto/sha256"
"crypto/sha512"
"encoding/hex"
"github.com/Eclalang/hash"
"testing"
)

func TestHashmd5(t *testing.T) {
testStr := "test"
expect := md5.Sum([]byte(testStr))
expected := hex.EncodeToString(expect[:])
actual := hash.Hashmd5(testStr)
actual := Hashmd5(testStr)
if actual != expected {
t.Errorf("Expected %s, got %s", expected, actual)
}
Expand All @@ -24,7 +23,7 @@ func TestHashsha1(t *testing.T) {
testStr := "test"
expect := sha1.Sum([]byte(testStr))
expected := hex.EncodeToString(expect[:])
actual := hash.Hashsha1(testStr)
actual := Hashsha1(testStr)
if actual != expected {
t.Errorf("Expected %s, got %s", expected, actual)
}
Expand All @@ -34,7 +33,7 @@ func TestHashsha224(t *testing.T) {
testStr := "test"
expect := sha256.Sum224([]byte(testStr))
expected := hex.EncodeToString(expect[:])
actual := hash.Hashsha224(testStr)
actual := Hashsha224(testStr)
if actual != expected {
t.Errorf("Expected %s, got %s", expected, actual)
}
Expand All @@ -44,7 +43,7 @@ func TestHashsha256(t *testing.T) {
testStr := "test"
expect := sha256.Sum256([]byte(testStr))
expected := hex.EncodeToString(expect[:])
actual := hash.Hashsha256(testStr)
actual := Hashsha256(testStr)
if actual != expected {
t.Errorf("Expected %s, got %s", expected, actual)
}
Expand All @@ -54,7 +53,7 @@ func TestHashsha384(t *testing.T) {
testStr := "test"
expect := sha512.Sum384([]byte(testStr))
expected := hex.EncodeToString(expect[:])
actual := hash.Hashsha384(testStr)
actual := Hashsha384(testStr)
if actual != expected {
t.Errorf("Expected %s, got %s", expected, actual)
}
Expand All @@ -64,7 +63,7 @@ func TestHashsha512(t *testing.T) {
testStr := "test"
expect := sha512.Sum512([]byte(testStr))
expected := hex.EncodeToString(expect[:])
actual := hash.Hashsha512(testStr)
actual := Hashsha512(testStr)
if actual != expected {
t.Errorf("Expected %s, got %s", expected, actual)
}
Expand All @@ -74,7 +73,7 @@ func TestHashsha512_224(t *testing.T) {
testStr := "test"
expect := sha512.Sum512_224([]byte(testStr))
expected := hex.EncodeToString(expect[:])
actual := hash.Hashsha512_224(testStr)
actual := Hashsha512_224(testStr)
if actual != expected {
t.Errorf("Expected %s, got %s", expected, actual)
}
Expand All @@ -84,7 +83,7 @@ func TestHashsha512_256(t *testing.T) {
testStr := "test"
expect := sha512.Sum512_256([]byte(testStr))
expected := hex.EncodeToString(expect[:])
actual := hash.Hashsha512_256(testStr)
actual := Hashsha512_256(testStr)
if actual != expected {
t.Errorf("Expected %s, got %s", expected, actual)
}
Expand Down

0 comments on commit 9ad4bf5

Please sign in to comment.