forked from cosmos/cosmos-sdk
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: remove comet dep in modules (1/n) (cosmos#20270)
- Loading branch information
1 parent
fd5c2f7
commit ca15c9d
Showing
9 changed files
with
85 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package types | ||
|
||
import "crypto/sha256" | ||
|
||
const TruncatedSize = 20 | ||
|
||
// AddressHash generates a hash of the given byte slice. | ||
// | ||
// bz: the byte slice to be hashed. | ||
// []byte: the hashed result. | ||
func AddressHash(bz []byte) []byte { | ||
return SumTruncated(bz) | ||
} | ||
|
||
// SumTruncated calculates the SHA256 hash of the given byte slice and returns the first TruncatedSize bytes. | ||
// | ||
// Parameters: | ||
// - bz: the byte slice to calculate the hash for. | ||
// | ||
// Returns: | ||
// - []byte: the first TruncatedSize bytes of the calculated hash. | ||
func SumTruncated(bz []byte) []byte { | ||
hash := sha256.Sum256(bz) | ||
return hash[:TruncatedSize] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters