Skip to content

0fuz/SignatureProfanity

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SignatureProfanity

Tool to find signature from given solidity functionName(address,uint) using all CPU-cores.

Suitable for finding exact signature to reduce gas usage a bit.

Compile from source code

# install golang https://go.dev/doc/install
git clone https://github.com/0fuz/SignatureProfanity.git
go mod tidy
go build

How it works:

  1. Solidity fn swap(address,uint256[]) which keccak256 signature is 0x97c3c44d (https://emn178.github.io/online-tools/keccak_256.html)
  2. Want pretty signature one of these 0x00000001,0x00000002,0x00000003,0x00000004,0x00000005,0x00000006,0x00000007,0x00000008,0x00000009
  3. ./SignatureProfanity "swap(address,uint256[])" 0x00000001,0x00000002,0x00000003,0x00000004,0x00000005,0x00000006,0x00000007,0x00000008,0x00000009
  4. # output of call:
    Arg length is 2
    Using arg sigs:  0x00000001,0x00000002,0x00000003,0x00000004,0x00000005,0x00000006,0x00000007,0x00000008,0x00000009
    CPU core count:  8
    Benchmark started
    Benchmark ended
    10k variants in  1.873ms
    Search target signature salt now...
    50000000
    100000000
    150000000
    200000000
    ...
    850000000
    swap_1bfbf68dd(address,uint256[]) 0x00000007
    900000000
    950000000
    1000000000
    swap_99b7df1d1(address,uint256[]) 0x00000002
    swap_e070d00c(address,uint256[]) 0x00000005
    1050000000
    1100000000
    1150000000
    ...
    1500000000
    swap_266bfa69b2(address,uint256[]) 0x00000004
  5. To have sig 0x00000002 need use fn name with salt: swap_99b7df1d1

About

Tool for finding exact solidity function signature

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages