Coder Social home page Coder Social logo

elliptic-curves-basics's Introduction

Elliptic Curves Basics

1. Given a random point n, is n a valid point on the sepc265k1 curve?

  • checkSpecp256k1Point
    • python3 checkSpecp256k1Point.py x y (should check x,y must in [1,p-1])?
    • python3 GetRandomPoint.py

2. generate an address that starts with 0x0000 GenerateProfanityAddress

  • python3 GenerateProfanityAddress.py

    • `private_key 0x3447dbf8b5f32b1dbae7abc969c9ab3da88a54f0c4d719c4c74bbac362102a8e
    • eth_addr 0x0000defe1e41e5da8303fedfd9b380664590ac3d`

3. Fuzzy-identity

  1. Deployed the contract on-chain FuzzyIdentityChallenge.sol

  2. howt to get the contract's identity?

    For hacking the authenticate

    1. one point is the caller should as smart contract supplying one funtion function name() external pure returns (bytes32) { return bytes32("smarx"); },
    2. Another point is the smart contract's address should include badc0de no matter its postion in the address.
  3. The steps to get the identity.

    1. Create the ExploitContract

    2. Using create2 to create above contract by selecting a rondom salt to make the smart contract's address inludes badc0de

    3. As create2 creating one contract, there are three params needed, one is the factory contract, one is the created contract's creationCode, one is salt.

      1. For the facotry contract CreateContract, which will create the ExploitContract contract, deployed address is CreateContract
      2. As factory contract address, CreateContract's creationCode code known, Calculatingthe possible salt brutely force which make the CreateContract's address includes badc0de.

      Considering the efficiency, I use the this tool github:styled-evm-address,styled-evm-addres

      1. Then using the salt call CreateContract's createDesiredAddress function.
    4. Now the ExploitContract was deployed and its address includes badc0de, directly call exploit() getting the identity. on-chain-tx

Other info

  1. https://0xfoobar.substack.com/p/vanity-addresses
  2. https://github.com/0age/create2crunch
  3. The efficient ways to minting the vantiy address
    1. VanityEth, which use more cpus to generate address and the random seed is based on 2^256.
    2. create2crunch using rust language
    3. Spin up a GPU Example instance using vast.ai.
  4. The private-key can be calculated by the generated vanity-addresses which have some problem. the-profanity-address-hack-how-are-vanity-addresses-generated
    1. python generate_vanity_address_ethereum_problem.py, the logic generate the vulnerability address.
    2. implement the code to hack the vanity_address which has problem toodo

Questions

  1. when checking point(x,y) # x,y must in the field [1,p-1] todo check ?
  2. check below
    • ECDSA (for Elliptic Curve Digital Signature Algorithm), can sign messages that are greater than P?
    • RSA can only sign messages that are smaller than its p?

elliptic-curves-basics's People

Contributors

sodexx7 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.