Skip to content

Commit

Permalink
Update ecdsa.k
Browse files Browse the repository at this point in the history
  • Loading branch information
Scott-Guest committed Oct 23, 2023
1 parent d2face5 commit 84a529c
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions test/ecdsa/ecdsa.k
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,13 @@ module ECDSA
imports STRING
imports BOOL

syntax String ::= Hex2Raw ( String ) [function]
| Keccak256 ( String ) [function, hook(KRYPTO.keccak256)]
| ECDSAPubKey ( String ) [function, hook(KRYPTO.ecdsaPubKey)]
syntax String ::= Keccak256 ( Bytes ) [function, hook(KRYPTO.keccak256)]
| ECDSAPubKey ( Bytes ) [function, hook(KRYPTO.ecdsaPubKey)]
// -----------------------------------------------
rule Hex2Raw ( S ) => #unparseByteStack( #parseByteStack ( S ) )

syntax Int ::= #addrFromPrivateKey ( String ) [function, klabel(addrFromPrivateKey)]
// ------------------------------------------------------------------------------------
rule [addrFromPrivateKey]: #addrFromPrivateKey ( KEY ) => #addr( #parseHexWord( Keccak256 ( Hex2Raw ( ECDSAPubKey( Hex2Raw ( KEY ) ) ) ) ) )
rule [addrFromPrivateKey]: #addrFromPrivateKey ( KEY ) => #addr( #parseHexWord( Keccak256( #parseByteStack( ECDSAPubKey( #parseByteStack( KEY ) ) ) ) ) )

syntax Int ::= #parseHexWord ( String ) [function]
// --------------------------------------------------
Expand All @@ -36,10 +34,6 @@ module ECDSA
rule #alignHexString(S) => S requires lengthString(S) modInt 2 ==Int 0
rule #alignHexString(S) => "0" +String S requires notBool lengthString(S) modInt 2 ==Int 0

syntax String ::= #unparseByteStack ( Bytes ) [function, klabel(unparseByteStack), symbol]
// ------------------------------------------------------------------------------------------
rule #unparseByteStack(WS) => Bytes2String(WS)

syntax String ::= #unparseData ( Int, Int ) [function]
| #unparseDataBytes ( Bytes ) [function]
// ------------------------------------------------------------
Expand Down

0 comments on commit 84a529c

Please sign in to comment.