Giter Club home page Giter Club logo

rust-hashcash-ddos's Introduction

Rust hashcash POW anti-ddos

To prevent a DDOS attack, we use the Hashcash algorithm for confirming the work of the client. The client will not be able to make a DDoS attack, since for each request it needs to calculate the hash, which takes time.

  1. Client generates a message
  2. Client appends a sequence to the message and hashes it using SHA256 until the first 20 bits of the hash are zero. This takes about a second. Because it is necessary to sort out several million hashes
  3. When the hash is solved, the client sends a message to the server.
  4. The server calculates a hash from the message. If the hash has the first 20 bits set to zero, then the message is considered valid.
  5. The server writes the hash from the message to the store so that the client cannot use it a second time
  6. The server returns a response to the client

Launch server

docker-compose -f docker-compose.server.yml build
docker-compose -f docker-compose.server.yml up

Launch client

docker-compose -f docker-compose.client.yml build
docker-compose -f docker-compose.client.yml up
  1. server Server side
  2. client Client side
  3. lib Common lib

rust-hashcash-ddos's People

Contributors

drmick avatar

Stargazers

 avatar  avatar  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.