mirror of
https://github.com/arnaucube/hermez-node.git
synced 2026-02-07 19:36:44 +01:00
Add HashGlobalInputs for ZKInputs
Add HashGlobalInputs for ZKInputs compatible with js & circom circuits version.
Compatible with hermeznetwork/commonjs at version: c6a1448db5bae4cda839ce36c1f35d8defccc9cd
(c6a1448db5)
This commit is contained in:
21
common/utils_test.go
Normal file
21
common/utils_test.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package common
|
||||
|
||||
import (
|
||||
"encoding/hex"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestBJJFromStringWithChecksum(t *testing.T) {
|
||||
s := "21b0a1688b37f77b1d1d5539ec3b826db5ac78b2513f574a04c50a7d4f8246d7"
|
||||
pk, err := BJJFromStringWithChecksum(s)
|
||||
assert.Nil(t, err)
|
||||
sBytes, err := hex.DecodeString(s)
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, hex.EncodeToString(SwapEndianness(sBytes)), pk.Compress().String())
|
||||
|
||||
// expected values computed with js implementation
|
||||
assert.Equal(t, "2492816973395423007340226948038371729989170225696553239457870892535792679622", pk.X.String())
|
||||
assert.Equal(t, "15238403086306505038849621710779816852318505119327426213168494964113886299863", pk.Y.String())
|
||||
}
|
||||
Reference in New Issue
Block a user