Skip to content

Commit

Permalink
native: adjust NamedCurveHash values
Browse files Browse the repository at this point in the history
Use 122 and 123 respectively for Secp256k1Keccak256 and
Secp256r1Keccak256, ref.
neo-project/neo#3209 (comment).

Signed-off-by: Anna Shaleva <[email protected]>
  • Loading branch information
AnnaShaleva committed May 13, 2024
1 parent 9884409 commit 67f9c10
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions pkg/core/native/crypto.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ type NamedCurveHash byte
const (
Secp256k1Sha256 NamedCurveHash = 22
Secp256r1Sha256 NamedCurveHash = 23
Secp256k1Keccak256 NamedCurveHash = 24
Secp256r1Keccak256 NamedCurveHash = 25
Secp256k1Keccak256 NamedCurveHash = 122
Secp256r1Keccak256 NamedCurveHash = 123
)

const cryptoContractID = -3
Expand Down
12 changes: 6 additions & 6 deletions pkg/core/native/native_test/cryptolib_verification_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ func buildKoblitzVerificationScript(t *testing.T, pub *keys.PublicKey) []byte {
// READY: loaded 110 instructions
// NEO-GO-VM 0 > ops
// INDEX OPCODE PARAMETER
// 0 PUSHINT8 24 (18) <<
// 0 PUSHINT8 122 (7a) <<
// 2 SWAP
// 3 PUSHDATA1 02a088bfab1e4b4bede7d4624572861b401cb20c3b14e90687bd8862272a4e6166
// 38 SYSCALL System.Runtime.GetNetwork (c5fba0e0)
Expand Down Expand Up @@ -232,7 +232,7 @@ func buildKoblitzVerificationScriptSimpleSingleHash(t *testing.T, pub *keys.Publ
// READY: loaded 98 instructions
// NEO-GO-VM 0 > ops
// INDEX OPCODE PARAMETER
// 0 PUSHINT8 24 (18) <<
// 0 PUSHINT8 122 (7a) <<
// 2 SWAP
// 3 PUSHDATA1 0363d7a48125a76cdea6e098c9f128e82920ed428e5fb4caf1d7f81c16cad0c205
// 38 SYSCALL System.Runtime.GetNetwork (c5fba0e0)
Expand Down Expand Up @@ -288,7 +288,7 @@ func buildKoblitzVerificationScriptSimpleSingleHashStaticMagic(t *testing.T, pub
// READY: loaded 95 instructions
// NEO-GO-VM 0 > ops
// INDEX OPCODE PARAMETER
// 0 PUSHINT8 24 (18) <<
// 0 PUSHINT8 122 (7a) <<
// 2 SWAP
// 3 PUSHDATA1 0296e13080ade92a2ab722338c2a249ee8d83a14f649c68321664165f06bd110bd
// 38 PUSHINT8 42 (2a)
Expand Down Expand Up @@ -348,7 +348,7 @@ func buildKoblitzVerificationScriptSimple(t *testing.T, pub *keys.PublicKey) []b
// READY: loaded 136 instructions
// NEO-GO-VM 0 > ops
// INDEX OPCODE PARAMETER
// 0 PUSHINT8 24 (18) <<
// 0 PUSHINT8 122 (7a) <<
// 2 SWAP
// 3 PUSHDATA1 03a77f137afbb4b68d7a450aa5a28fe335f804c589a808494b4b626eb98707f37d
// 38 SYSCALL System.Runtime.GetNetwork (c5fba0e0)
Expand Down Expand Up @@ -449,7 +449,7 @@ func buildKoblitzVerificationScriptCompat(t *testing.T, pub *keys.PublicKey) []b
// READY: loaded 186 instructions
// NEO-GO-VM 0 > ops
// INDEX OPCODE PARAMETER
// 0 PUSHINT8 24 (18) <<
// 0 PUSHINT8 122 (7a) <<
// 2 SWAP
// 3 PUSHDATA1 02627ef9c3631e3ccb8fbc4c5b6c49e38ccede5a79afb1e1b0708fbb958a7802d7
// 38 SYSCALL System.Runtime.GetNetwork (c5fba0e0)
Expand Down Expand Up @@ -866,7 +866,7 @@ func buildKoblitzMultisigVerificationScript(t *testing.T, m int, pubs keys.Publi
// 193 GE
// 194 OR
// 195 JMPIF 261 (66/42)
// 197 PUSHINT8 24 (18)
// 197 PUSHINT8 122 (7a)
// 199 LDLOC0
// 200 LDLOC3
// 201 PICKITEM
Expand Down
4 changes: 2 additions & 2 deletions pkg/interop/native/crypto/crypto.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ type NamedCurveHash byte
const (
Secp256k1Sha256 NamedCurveHash = 22
Secp256r1Sha256 NamedCurveHash = 23
Secp256k1Keccak256 NamedCurveHash = 24
Secp256r1Keccak256 NamedCurveHash = 25
Secp256k1Keccak256 NamedCurveHash = 122
Secp256r1Keccak256 NamedCurveHash = 123
)

// Sha256 calls `sha256` method of native CryptoLib contract and computes SHA256 hash of b.
Expand Down

0 comments on commit 67f9c10

Please sign in to comment.