Skip to content

Commit

Permalink
Native: update NamedCurveHash values for Keccak256 hasher
Browse files Browse the repository at this point in the history
Use 122 and 123 respectively for secp256k1Keccak256 and
secp256r1Keccak256.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
  • Loading branch information
AnnaShaleva committed May 6, 2024
1 parent 018968f commit e7d9122
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
7 changes: 2 additions & 5 deletions src/Neo/SmartContract/Native/NamedCurveHash.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ namespace Neo.SmartContract.Native
/// Represents a pair of the named curve used in ECDSA and a hash algorithm used to hash message.
/// This is a compatible extension of an obsolete <see cref="NamedCurve"/> enum.
/// </summary>
/// <remarks>
/// https://tools.ietf.org/html/rfc4492#section-5.1.1
/// </remarks>
public enum NamedCurveHash : byte
{
/// <summary>
Expand All @@ -33,11 +30,11 @@ public enum NamedCurveHash : byte
/// <summary>
/// The secp256k1 curve and Keccak256 hash algorithm.
/// </summary>
secp256k1Keccak256 = 24,
secp256k1Keccak256 = 122,

/// <summary>
/// The secp256r1 curve, which known as prime256v1 or nistP-256, and Keccak256 hash algorithm.
/// </summary>
secp256r1Keccak256 = 25
secp256r1Keccak256 = 123
}
}
4 changes: 2 additions & 2 deletions tests/Neo.UnitTests/SmartContract/Native/UT_CryptoLib.cs
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ public void TestVerifyWithECDsa_CustomTxWitness_SingleSig()
// Error: No help topic for 'pos'
// NEO-GO-VM 0 > ops
// INDEX OPCODE PARAMETER
// 0 PUSHINT8 24 (18) <<
// 0 PUSHINT8 122 (7a) <<
// 2 SWAP
// 3 PUSHDATA1 02fd0a8c1ce5ae5570fdd46e7599c16b175bf0ebdfe9c178f1ab848fb16dac74a5
// 38 SYSCALL System.Runtime.GetNetwork (c5fba0e0)
Expand Down Expand Up @@ -820,7 +820,7 @@ public void TestVerifyWithECDsa_CustomTxWitness_MultiSig()
// 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

0 comments on commit e7d9122

Please sign in to comment.