Coder Social home page Coder Social logo

jequix's Introduction

Java Equi-X
---------------------------

Tor-compatible HS PoW, Equi-X(60,3), and HashX.

References:

- https://spec.torproject.org/hspow-spec/index.html
- https://github.com/tevador/equix
- https://github.com/tevador/hashx

While PoW is well-specified, Equi-X and HashX are poorly documented,
and almost impossible to specify. All HashX program generation code,
including the deterministic RNG, must be reproduced exactly.
This is a fairly direct translation of tevador's C code to Java,
and is therefore licensed the same as that code, LGPLv3.

Equi-X and HashX test vectors are from those projects and all pass.

PoW 40 byte proof (without the leading 0x01) is identical to Tor's HS PoW.
PoW test vectors are from Tor and licensed the same as Tor (BSD).
One test is failing for unknown reasons.

Interpreted hash rate is about 150K hashes/sec, which is a little
slower than the C interpreted speed.

HashX compilation is supported if ant and ECJ are available at runtime.
This provides about a 10X speedup after the compilation.
The first compilation takes about 750 ms to load the ant and ECJ classes,
but subsequent compiles are about 50-100 ms.

Compiled hash rate is currently about 1.5 million hashes/sec, which is
about 2-3x slower than HashX compiled mode. Compilation is definitely
worth it for the solver, which runs 64K hashes per program.
Unfortunately, the compilation overhead makes this uncompetitive
with the C implementation.

Equi-X requires 1.8 MB of heap to find solutions.
This implementation uses about the same, plus lots of Java overhead of course.

Equi-X solving supports multi-threading within a single context.
Thread count must be a power of two. Multi-threading provides
speedups without increasing memory usage.
PoW is currently single-threaded, multi-threading (one for each seed) is not yet supported.
PoW multi-threading would require 1.8 MB of heap for each thread.
PoW verification is relatively fast, as in the C code.
As verification only requires 8 hashes (vs 64K hashes for each solution attempt),
verification does not benefit from compilation as the overhead is too great.


Blake2b code is adapted from Noise, see LICENSE-Noise.txt.

Build requires ant, Java 8 or higher, and i2p source in ../i2p.i2p.
Runtime requires Java 8 or higher and i2p.jar.
For optional compilation at runtime, ant and ECJ are required.
ECJ is now provided by eclipse-jdt: sudo apt install libeclipse-jdt-core-java,
the older libecj-java package is not recommended.
I2P dependency is only for a few utilities.

jequix's People

Contributors

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