@@ -20,6 +20,7 @@ import (
20
20
"fmt"
21
21
22
22
"github.com/blinklabs-io/gouroboros/cbor"
23
+ "github.com/blinklabs-io/plutigo/pkg/data"
23
24
"github.com/btcsuite/btcd/btcutil/bech32"
24
25
"golang.org/x/crypto/blake2b"
25
26
)
@@ -46,6 +47,10 @@ func (b Blake2b256) Bytes() []byte {
46
47
return b [:]
47
48
}
48
49
50
+ func (b Blake2b256 ) ToPlutusData () data.PlutusData {
51
+ return data .NewByteString (b [:])
52
+ }
53
+
49
54
// Blake2b256Hash generates a Blake2b-256 hash from the provided data
50
55
func Blake2b256Hash (data []byte ) Blake2b256 {
51
56
tmpHash , err := blake2b .New (Blake2b256Size , nil )
@@ -77,6 +82,10 @@ func (b Blake2b224) Bytes() []byte {
77
82
return b [:]
78
83
}
79
84
85
+ func (b Blake2b224 ) ToPlutusData () data.PlutusData {
86
+ return data .NewByteString (b [:])
87
+ }
88
+
80
89
func (b Blake2b224 ) MarshalJSON () ([]byte , error ) {
81
90
return json .Marshal (b .String ())
82
91
}
@@ -112,6 +121,10 @@ func (b Blake2b160) Bytes() []byte {
112
121
return b [:]
113
122
}
114
123
124
+ func (b Blake2b160 ) ToPlutusData () data.PlutusData {
125
+ return data .NewByteString (b [:])
126
+ }
127
+
115
128
// Blake2b160Hash generates a Blake2b-160 hash from the provided data
116
129
func Blake2b160Hash (data []byte ) Blake2b160 {
117
130
tmpHash , err := blake2b .New (Blake2b160Size , nil )
0 commit comments