diff --git a/packages/crypto/hash20.go b/packages/crypto/hash20.go new file mode 100644 index 0000000000000000000000000000000000000000..9804b9fdb98fbc66c2769a65e740ecd86adc59d1 --- /dev/null +++ b/packages/crypto/hash20.go @@ -0,0 +1,16 @@ +package crypto + +import ( + "crypto/sha256" + "golang.org/x/crypto/ripemd160" +) + +func Hash20(input []byte) []byte { + sha256Hasher := sha256.New() + sha256Hasher.Write(input) + + ripemd160Hasher := ripemd160.New() + ripemd160Hasher.Write(sha256Hasher.Sum(nil)) + + return ripemd160Hasher.Sum(nil) +} diff --git a/packages/identity/identity.go b/packages/identity/identity.go index 05815470eb30d85715a6e821b4235cb3b8b58581..0aa55efdb8077d653fddac57bf516b23d6d3d204 100644 --- a/packages/identity/identity.go +++ b/packages/identity/identity.go @@ -7,7 +7,7 @@ import ( "crypto/sha256" "fmt" "github.com/ethereum/go-ethereum/crypto/secp256k1" - "github.com/iotadevelopment/consensus/crypto" + "github.com/iotaledger/goshimmer/packages/crypto" ) type Identity struct { diff --git a/plugins/autopeering/saltmanager/utils.go b/plugins/autopeering/saltmanager/utils.go index bc7c2046b38ded5dfbe29b47c0cb9868338ba895..5142c84beeb8b2786a7493a83d9f3f3a8ebd887f 100644 --- a/plugins/autopeering/saltmanager/utils.go +++ b/plugins/autopeering/saltmanager/utils.go @@ -1,7 +1,6 @@ package saltmanager import ( - "github.com/iotadevelopment/shimmer/plugins/autopeering/saltmanager" "github.com/iotaledger/goshimmer/plugins/autopeering/protocol/salt" "time" ) @@ -11,7 +10,7 @@ func CheckSalt(saltToCheck *salt.Salt) error { if saltToCheck.ExpirationTime.Before(now.Add(-1 * time.Minute)) { return ErrPublicSaltExpired } - if saltToCheck.ExpirationTime.After(now.Add(saltmanager.PUBLIC_SALT_LIFETIME + 1 * time.Minute)) { + if saltToCheck.ExpirationTime.After(now.Add(PUBLIC_SALT_LIFETIME + 1 * time.Minute)) { return ErrPublicSaltInvalidLifetime }