mirror of
https://github.com/arnaucube/go-ethereum.git
synced 2026-02-28 05:56:45 +01:00
24 lines
344 B
Go
24 lines
344 B
Go
package main
|
|
|
|
import (
|
|
"strconv"
|
|
"crypto/sha256"
|
|
"encoding/hex"
|
|
)
|
|
|
|
func Uitoa(i uint32) string {
|
|
return strconv.FormatUint(uint64(i), 10)
|
|
}
|
|
|
|
func Sha256Hex(data []byte) string {
|
|
hash := sha256.Sum256(data)
|
|
|
|
return hex.EncodeToString(hash[:])
|
|
}
|
|
|
|
func Sha256Bin(data []byte) []byte {
|
|
hash := sha256.Sum256(data)
|
|
|
|
return hash[:]
|
|
}
|