erigon-pulse/cmd/lightclient/utils/bytes.go
Giulio rebuffo 98ceb7cc9c
separation of handlers (#5581)
Co-authored-by: giuliorebuffo <giuliorebuffo@system76-pc.localdomain>
2022-09-30 19:07:13 +02:00

21 lines
298 B
Go

package utils
import (
"encoding/binary"
"encoding/hex"
)
func Uint32ToBytes4(n uint32) (ret [4]byte) {
binary.BigEndian.PutUint32(ret[:], n)
return
}
func BytesToBytes4(b []byte) (ret [4]byte) {
copy(ret[:], b)
return
}
func BytesToHex(b []byte) string {
return hex.EncodeToString(b)
}