6 "golang.org/x/crypto/sha3"
9 func TestComputeAssetID(t *testing.T) {
10 issuanceScript := []byte{1}
11 assetID := ComputeAssetID(issuanceScript, 1, &EmptyStringHash)
13 unhashed := append([]byte{})
14 unhashed = append(unhashed, []byte{0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}...) // vmVersion
15 unhashed = append(unhashed, 0x01) // length of issuanceScript
16 unhashed = append(unhashed, issuanceScript...)
17 unhashed = append(unhashed, EmptyStringHash.Bytes()...)
19 if want := NewAssetID(sha3.Sum256(unhashed)); assetID != want {
20 t.Errorf("asset id = %x want %x", assetID.Bytes(), want.Bytes())
24 var assetIDSink AssetID
26 func BenchmarkComputeAssetID(b *testing.B) {
28 issuanceScript = []byte{5}
31 for i := 0; i < b.N; i++ {
32 assetIDSink = ComputeAssetID(issuanceScript, 1, &EmptyStringHash)