Git Product home page Git Product logo

ebmus's Introduction

EBMUS

Simple proof-of-work library. Given an arbitrary string, it finds a nonce such that, when appended to the string, its BLAKE 3 hash starts with a given number of hexadecimal zeros.

How to use

By default:

use ebmus::Puzzle;

let difficulty = 5;
let template = "EBMUS:::"
let mut puzzle = Puzzle::new(template);

puzzle.solve(difficulty).unwrap();
println!("{}", puzzle.to_string()); // EBMUS:::1437302
println!("{}", puzzle.nonce); // 1437302
println!("{}", puzzle.hash()); // 000004c14153250a5234dfdca6a4a40c09ce8545fbe323463567631d05759516

If you are using the "template" feature:

use ebmus::template::Template;

let template = Template::new("EBMUS"); // EBMUS:  1672169715:9doEQzRH3U76KKH2:::
let mut puzzle = Puzzle::new(template);

//...

You can create your own custom template, as long as it implements the ToString trait. For example, the "template" feature contains a Template struct defined by

struct Template {
  name: String,
  timestamp: i64,
  token: String,
}

which resolves to the string "EBMUS: 1672169715:9doEQzRH3U76KKH2:::".

TODO

  • add documentation
  • add tests
  • instead of looking for hexadecimal zeros, find binary zeros.

ebmus's People

Contributors

tempdata73 avatar

Stargazers

Javier Liendo avatar

Watchers

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