Skip to content

v1.0.0

Latest

Choose a tag to compare

@thewizardplusplus thewizardplusplus released this 02 May 05:16

The major version.

Features

  • use of patterns:
  • definition of challenges with the following fields:
    • leading zero bit count — the required number of leading zero bits in the resulting hash;
    • target bit index — a bit index used in determining the solution’s difficulty:
      • it refers to the bit position such that the resulting hash will be less than the number where that bit is set (for example, with a 256-bit hash and a requirement of 6 leading zeros, we would set the 250th bit);
      • only one of leading zero bit count or target bit index should be set explicitly — the other is derived from it;
    • created at (optional) — the timestamp when the challenge was created;
    • TTL (optional) — the duration after which the challenge expires:
      • created at and TTL must either be both specified or both omitted;
    • resource (optional) — the resource associated with the challenge, typically for scoping:
    • serialized payload — the raw data to be included in the hash:
      • must be pre-serialized to a string; the library does not handle serialization itself;
    • hash — the hash function used to verify the solution:
    • hash data layout — the structure of the data used during hashing:
      • based on the text/template.Template type;
      • defines which fields of the challenge will be hashed and in what order, giving full control over the hash input structure;
  • generation of solutions that meet specified challenge criteria:
    • starting nonce value:
      • it can be zero;
      • it can be randomly selected within a given range;
    • the generation process can be interrupted via:
      • context cancellation;
      • an attempt limit;
  • validation of solutions against their corresponding challenges;
  • sentinel errors provided through a dedicated errors subpackage.