mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-25 03:47:18 +00:00
crypto: export GetSignedData function
It's needed for tests and further custom verification script build. Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
This commit is contained in:
parent
34eef47a18
commit
bd2f9c75e1
1 changed files with 5 additions and 2 deletions
|
@ -16,7 +16,10 @@ type Hashable interface {
|
|||
Hash() util.Uint256
|
||||
}
|
||||
|
||||
func getSignedData(net uint32, hh Hashable) []byte {
|
||||
// GetSignedData returns the concatenated byte slice containing of the network
|
||||
// magic in constant-length 4-bytes LE representation and hashable item hash in BE
|
||||
// representation.
|
||||
func GetSignedData(net uint32, hh Hashable) []byte {
|
||||
var b = make([]byte, 4+util.Uint256Size)
|
||||
binary.LittleEndian.PutUint32(b, net)
|
||||
h := hh.Hash()
|
||||
|
@ -27,7 +30,7 @@ func getSignedData(net uint32, hh Hashable) []byte {
|
|||
// NetSha256 calculates a network-specific hash of the Hashable item that can then
|
||||
// be signed/verified.
|
||||
func NetSha256(net uint32, hh Hashable) util.Uint256 {
|
||||
return Sha256(getSignedData(net, hh))
|
||||
return Sha256(GetSignedData(net, hh))
|
||||
}
|
||||
|
||||
// Sha256 hashes the incoming byte slice
|
||||
|
|
Loading…
Reference in a new issue