36 lines
900 B
Go
36 lines
900 B
Go
package commitment
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestCommR(t *testing.T) {
|
|
var commC = [32]byte{
|
|
0x09, 0x1e, 0x07, 0x3b, 0x98, 0x2f, 0x66, 0xf0,
|
|
0x13, 0xc0, 0x26, 0xda, 0x6e, 0x54, 0xd8, 0x7d,
|
|
0xbf, 0x8b, 0xba, 0x84, 0x8e, 0xf5, 0x7a, 0x55,
|
|
0x29, 0xc7, 0xe7, 0xf7, 0x2c, 0x82, 0x88, 0x43,
|
|
}
|
|
|
|
var commRLast = [32]byte{
|
|
0xf0, 0xc5, 0x78, 0x5c, 0x6c, 0x8c, 0xf6, 0x2d,
|
|
0x96, 0x8b, 0x1e, 0xcd, 0x68, 0xed, 0xb9, 0xd9,
|
|
0x1e, 0xb9, 0x44, 0x5c, 0x78, 0x58, 0xa6, 0x00,
|
|
0x26, 0xf8, 0x82, 0x68, 0x60, 0xf7, 0xe7, 0x68,
|
|
}
|
|
|
|
res, err := CommR(commC, commRLast)
|
|
require.NoError(t, err)
|
|
|
|
var expected = [32]byte{
|
|
0xe6, 0x74, 0xd1, 0x9e, 0x6c, 0xe7, 0xfc, 0xf3,
|
|
0x3b, 0xbf, 0xd9, 0xb3, 0x43, 0xa0, 0xce, 0xb1,
|
|
0x2d, 0x28, 0x31, 0xd1, 0xda, 0x54, 0x31, 0x61,
|
|
0x89, 0x1e, 0xbc, 0xca, 0xd2, 0xc6, 0xdb, 0x01,
|
|
}
|
|
|
|
require.Equal(t, res, expected)
|
|
}
|