Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Algorithm Optimizations #5

Open
wants to merge 29 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
9db7f5d
refactor: :running_man: :fire: :camel: bytes over strings [+]
marcoonroad Nov 25, 2018
50d910e
docs: :book: :rocket: :anchor: bumping/updating documentation
marcoonroad Nov 25, 2018
df28d0d
refactor: :zap: :recycle: :fist_oncoming: dropped many PRNG calls fro…
marcoonroad Mar 2, 2019
dda1014
refactor: :recycle: generating private key pieces on-demand
marcoonroad Mar 7, 2019
9982fbd
refactor: :recycle: short public key size at the expense of huge sign…
marcoonroad Mar 10, 2019
6efc8b0
refactor: :recycle: :closed_lock_with_key: :eyes: dropping AES ECB by…
marcoonroad Mar 17, 2019
d23fb9a
:recycle: refactor: ongoing refactor process to add laziness in some …
marcoonroad Apr 8, 2019
f55fb43
docs: :book: bumping license year
marcoonroad Jul 13, 2019
c9657a1
refactor: :recycle: using Blake2B instead of SHA256 to derive IV from…
marcoonroad Jul 13, 2019
5b96550
refactor: :recycle: changing split character to not collide with our …
marcoonroad Jul 13, 2019
993852e
refactor: :recycle: moving out the digest hash function used to verif…
marcoonroad Jul 13, 2019
9a7c2ee
docs: :book: bump due minor change on entry-point interface / module …
marcoonroad Jul 13, 2019
d6f7b50
optimization: :zap: pre-computed public key embedded on private key i…
marcoonroad Sep 15, 2019
5b2246d
refactor: :recycle: separated module Constants to deal with configura…
marcoonroad Sep 15, 2019
61cbbee
refactor: :recycle: moving pieces verification/comparison procedure f…
marcoonroad Sep 28, 2019
bacf7f2
refactor: :recycle: improved xor usage in specific and safe contexts
marcoonroad Sep 29, 2019
f162239
wip: :construction: adding winternitz compression with parameter w = …
marcoonroad Sep 29, 2019
21a1d75
refactor: :recycle: padding "PRF" indexes with leading zeroes prior x…
marcoonroad Sep 29, 2019
526ad34
ft: :star: adding winternitz checksum by adding more 2 bytes into sig…
marcoonroad Sep 29, 2019
b34d44b
refactor: :recycle: dropping laziness 'cause it isn't useful anymore …
marcoonroad Sep 29, 2019
a558b10
refactor: :recycle: precomputed null-hash and null-address
marcoonroad Oct 13, 2019
1953706
refactor: :recycle: inline List.map closure steps
marcoonroad Oct 13, 2019
faadc83
refactor: :recycle: dropping recursive hashchain function in favor of…
marcoonroad Oct 13, 2019
de7b9e3
refactor: :recycle: using native digestif function to hash a sequence…
marcoonroad Oct 13, 2019
d8bc751
refactor: :recycle: precomputed list of seed suffixes/keys for signin…
marcoonroad Oct 27, 2019
f4ff4fe
refactor: :recycle: blacklist prefix
marcoonroad Oct 27, 2019
0d62fa3
refactor: :recycle: adding Blake2B Keyed Mode (a.k.a MAC) as PRF for …
marcoonroad Oct 27, 2019
a646e9d
bugfix: :beetle: fixing unnecessary/bogus padding
marcoonroad Sep 16, 2020
18e54c4
chore: :gear: some adjustments for dune build with higher dependencie…
Nov 7, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
# Frontend to dune.

OCAML_VERSION := $(shell opam var switch)

.PHONY: default vendor build doc install uninstall test coverage report clean

addon:
opam install merlin ocp-indent ocamlformat utop --yes

vendor:
opam install . --deps-only --yes

Expand All @@ -23,7 +28,8 @@ doc: build
mkdir -p docs/apiref
dune build @doc
make doc-index
mv _build/default/_doc/_html/* docs/apiref/
mv _build/$(OCAML_VERSION)/_doc/_html/* docs/apiref/ || \
mv _build/default/_doc/_html/* docs/apiref/

### Alcotest environment variables:
#
Expand All @@ -36,7 +42,7 @@ test: build

bench: clean build
opam install core_bench --yes
opam depext conf-secp256k1 secp256k1 --install
opam depext conf-secp256k1 secp256k1 --install --yes
dune build @test/bench/runtest -f --no-buffer -j 1 --auto-promote \
--diff-command="git diff --unified=10 --break-rewrites --no-index --exit-code --histogram --word-diff=none --color --no-prefix" || echo \
"\n\n=== Differences detected! ===\n\n"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ For further information, see:
This library uses the Blake2B hash algorithm, but further / additional hashes are
planned as well. Currently, the following things are implemented now:

- [x] Importing/exporting encrypted private key (by now using AES ECB).
- [x] Importing/exporting encrypted private key (by now using AES CBC).
- [x] Public Key serialization+validation (to share and receive such key for verification).
- [x] Built-in one-time invariant protected by a blacklist of used private keys.
- [x] Tests covering the things here and there.
Expand Down
2 changes: 1 addition & 1 deletion docs/apiref/hieroglyphs/Hieroglyphs__/Hash/index.html
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Hash (hieroglyphs.Hieroglyphs__.Hash)</title><link rel="stylesheet" href="../../../odoc.css"/><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><script src="../../../highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body><div class="content"><header><nav><a href="../index.html">Up</a> – <a href="../../index.html">hieroglyphs</a> &#x00BB; <a href="../index.html">Hieroglyphs__</a> &#x00BB; Hash</nav><h1>Module <code>Hieroglyphs__.Hash</code></h1></header><dl><dt class="spec value" id="val-digest"><a href="#val-digest" class="anchor"></a><code><span class="keyword">val </span>digest : string <span>&#45;&gt;</span> string</code></dt><dt class="spec value" id="val-sha256"><a href="#val-sha256" class="anchor"></a><code><span class="keyword">val </span>sha256 : string <span>&#45;&gt;</span> string</code></dt></dl></div></body></html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Hash (hieroglyphs.Hieroglyphs__.Hash)</title><link rel="stylesheet" href="../../../odoc.css"/><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><script src="../../../highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body><div class="content"><header><nav><a href="../index.html">Up</a> – <a href="../../index.html">hieroglyphs</a> &#x00BB; <a href="../index.html">Hieroglyphs__</a> &#x00BB; Hash</nav><h1>Module <code>Hieroglyphs__.Hash</code></h1></header><dl><dt class="spec value" id="val-digest"><a href="#val-digest" class="anchor"></a><code><span class="keyword">val </span>digest : string <span>&#45;&gt;</span> string</code></dt><dt class="spec value" id="val-digest_bytes"><a href="#val-digest_bytes" class="anchor"></a><code><span class="keyword">val </span>digest_bytes : bytes <span>&#45;&gt;</span> bytes</code></dt><dt class="spec value" id="val-mine"><a href="#val-mine" class="anchor"></a><code><span class="keyword">val </span>mine : difficulty:int <span>&#45;&gt;</span> string <span>&#45;&gt;</span> Cstruct.t</code></dt></dl></div></body></html>
2 changes: 1 addition & 1 deletion docs/apiref/hieroglyphs/Hieroglyphs__/Keys/index.html
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Keys (hieroglyphs.Hieroglyphs__.Keys)</title><link rel="stylesheet" href="../../../odoc.css"/><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><script src="../../../highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body><div class="content"><header><nav><a href="../index.html">Up</a> – <a href="../../index.html">hieroglyphs</a> &#x00BB; <a href="../index.html">Hieroglyphs__</a> &#x00BB; Keys</nav><h1>Module <code>Hieroglyphs__.Keys</code></h1></header><div class="spec module" id="module-Bisect_visit___lib___keys___ml"><a href="#module-Bisect_visit___lib___keys___ml" class="anchor"></a><code><span class="keyword">module </span><a href="Bisect_visit___lib___keys___ml/index.html">Bisect_visit___lib___keys___ml</a> : <span class="keyword">sig</span> ... <span class="keyword">end</span></code></div><div class="spec module" id="module-List"><a href="#module-List" class="anchor"></a><code><span class="keyword">module </span>List = Core.List</code></div><div class="spec module" id="module-String"><a href="#module-String" class="anchor"></a><code><span class="keyword">module </span>String = Core.String</code></div><div class="spec module" id="module-Float"><a href="#module-Float" class="anchor"></a><code><span class="keyword">module </span>Float = Core.Float</code></div><div class="spec module" id="module-Int64"><a href="#module-Int64" class="anchor"></a><code><span class="keyword">module </span>Int64 = Core.Int64</code></div><div class="spec module" id="module-Option"><a href="#module-Option" class="anchor"></a><code><span class="keyword">module </span>Option = Core.Option</code></div><dl><dt class="spec value" id="val-populate"><a href="#val-populate" class="anchor"></a><code><span class="keyword">val </span>populate : <a href="index.html#module-String">String</a>.t <span>&#45;&gt;</span> <span class="type-var">'a</span> <span>&#45;&gt;</span> string</code></dt><dt class="spec value" id="val-length"><a href="#val-length" class="anchor"></a><code><span class="keyword">val </span>length : int</code></dt><dt class="spec value" id="val-timestamp"><a href="#val-timestamp" class="anchor"></a><code><span class="keyword">val </span>timestamp : unit <span>&#45;&gt;</span> Core_kernel__.Import.string</code></dt><dt class="spec value" id="val-generate"><a href="#val-generate" class="anchor"></a><code><span class="keyword">val </span>generate : unit <span>&#45;&gt;</span> string <a href="index.html#module-List">List</a>.t</code></dt><dt class="spec value" id="val-derive"><a href="#val-derive" class="anchor"></a><code><span class="keyword">val </span>derive : string <a href="index.html#module-List">List</a>.t <span>&#45;&gt;</span> string <a href="index.html#module-List">List</a>.t</code></dt><dt class="spec value" id="val-export"><a href="#val-export" class="anchor"></a><code><span class="keyword">val </span>export : priv:string <a href="index.html#module-List">List</a>.t <span>&#45;&gt;</span> pass:string <span>&#45;&gt;</span> string</code></dt><dt class="spec value" id="val-import"><a href="#val-import" class="anchor"></a><code><span class="keyword">val </span>import : cipher:string <span>&#45;&gt;</span> pass:string <span>&#45;&gt;</span> string list <a href="index.html#module-Option">Option</a>.t</code></dt><dt class="spec value" id="val-load"><a href="#val-load" class="anchor"></a><code><span class="keyword">val </span>load : string <span>&#45;&gt;</span> string list option</code></dt><dt class="spec value" id="val-show"><a href="#val-show" class="anchor"></a><code><span class="keyword">val </span>show : string list <span>&#45;&gt;</span> string</code></dt><dt class="spec value" id="val-address"><a href="#val-address" class="anchor"></a><code><span class="keyword">val </span>address : string list <span>&#45;&gt;</span> string</code></dt><dt class="spec value" id="val-sign"><a href="#val-sign" class="anchor"></a><code><span class="keyword">val </span>sign : priv:string list <span>&#45;&gt;</span> msg:string <span>&#45;&gt;</span> string</code></dt><dt class="spec value" id="val-verify"><a href="#val-verify" class="anchor"></a><code><span class="keyword">val </span>verify : pub:string list <span>&#45;&gt;</span> msg:string <span>&#45;&gt;</span> signature:string <span>&#45;&gt;</span> bool</code></dt></dl></div></body></html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Keys (hieroglyphs.Hieroglyphs__.Keys)</title><link rel="stylesheet" href="../../../odoc.css"/><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><script src="../../../highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body><div class="content"><header><nav><a href="../index.html">Up</a> – <a href="../../index.html">hieroglyphs</a> &#x00BB; <a href="../index.html">Hieroglyphs__</a> &#x00BB; Keys</nav><h1>Module <code>Hieroglyphs__.Keys</code></h1></header><dl><dt class="spec value" id="val-sign"><a href="#val-sign" class="anchor"></a><code><span class="keyword">val </span>sign : priv:bytes <span>&#45;&gt;</span> msg:string <span>&#45;&gt;</span> string</code></dt><dt class="spec value" id="val-verify"><a href="#val-verify" class="anchor"></a><code><span class="keyword">val </span>verify : pub:bytes <span>&#45;&gt;</span> msg:string <span>&#45;&gt;</span> signature:string <span>&#45;&gt;</span> bool</code></dt><dt class="spec value" id="val-show"><a href="#val-show" class="anchor"></a><code><span class="keyword">val </span>show : bytes <span>&#45;&gt;</span> string</code></dt><dt class="spec value" id="val-load"><a href="#val-load" class="anchor"></a><code><span class="keyword">val </span>load : string <span>&#45;&gt;</span> bytes option</code></dt><dt class="spec value" id="val-import"><a href="#val-import" class="anchor"></a><code><span class="keyword">val </span>import : cipher:string <span>&#45;&gt;</span> pass:string <span>&#45;&gt;</span> bytes option</code></dt><dt class="spec value" id="val-export"><a href="#val-export" class="anchor"></a><code><span class="keyword">val </span>export : priv:bytes <span>&#45;&gt;</span> pass:string <span>&#45;&gt;</span> string</code></dt><dt class="spec value" id="val-generate"><a href="#val-generate" class="anchor"></a><code><span class="keyword">val </span>generate : unit <span>&#45;&gt;</span> bytes</code></dt><dt class="spec value" id="val-derive"><a href="#val-derive" class="anchor"></a><code><span class="keyword">val </span>derive : bytes <span>&#45;&gt;</span> bytes</code></dt><dt class="spec value" id="val-address"><a href="#val-address" class="anchor"></a><code><span class="keyword">val </span>address : bytes <span>&#45;&gt;</span> string</code></dt></dl></div></body></html>
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Bisect_visit___lib___keys___ml (hieroglyphs.Hieroglyphs__.Keys.Bisect_visit___lib___keys___ml)</title><link rel="stylesheet" href="../../../../odoc.css"/><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><script src="../../../../highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body><div class="content"><header><nav><a href="../index.html">Up</a> – <a href="../../../index.html">hieroglyphs</a> &#x00BB; <a href="../../index.html">Hieroglyphs__</a> &#x00BB; <a href="../index.html">Keys</a> &#x00BB; Bisect_visit___lib___keys___ml</nav><h1>Module <code>Keys.Bisect_visit___lib___keys___ml</code></h1></header><dl><dt class="spec value" id="val-___bisect_visit___"><a href="#val-___bisect_visit___" class="anchor"></a><code><span class="keyword">val </span>___bisect_visit___ : int <span>&#45;&gt;</span> unit</code></dt></dl></div></body></html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Bisect_visit___lib___main___ml (hieroglyphs.Hieroglyphs__.Main.Bisect_visit___lib___main___ml)</title><link rel="stylesheet" href="../../../../odoc.css"/><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><script src="../../../../highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body><div class="content"><header><nav><a href="../index.html">Up</a> – <a href="../../../index.html">hieroglyphs</a> &#x00BB; <a href="../../index.html">Hieroglyphs__</a> &#x00BB; <a href="../index.html">Main</a> &#x00BB; Bisect_visit___lib___main___ml</nav><h1>Module <code>Main.Bisect_visit___lib___main___ml</code></h1></header><dl><dt class="spec value" id="val-___bisect_visit___"><a href="#val-___bisect_visit___" class="anchor"></a><code><span class="keyword">val </span>___bisect_visit___ : int <span>&#45;&gt;</span> unit</code></dt></dl></div></body></html>
2 changes: 2 additions & 0 deletions docs/apiref/hieroglyphs/Hieroglyphs__/Main/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Main (hieroglyphs.Hieroglyphs__.Main)</title><link rel="stylesheet" href="../../../odoc.css"/><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><script src="../../../highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body><div class="content"><header><nav><a href="../index.html">Up</a> – <a href="../../index.html">hieroglyphs</a> &#x00BB; <a href="../index.html">Hieroglyphs__</a> &#x00BB; Main</nav><h1>Module <code>Hieroglyphs__.Main</code></h1></header><div class="spec module" id="module-Bisect_visit___lib___main___ml"><a href="#module-Bisect_visit___lib___main___ml" class="anchor"></a><code><span class="keyword">module </span><a href="Bisect_visit___lib___main___ml/index.html">Bisect_visit___lib___main___ml</a> : <span class="keyword">sig</span> ... <span class="keyword">end</span></code></div><div class="spec module" id="module-Option"><a href="#module-Option" class="anchor"></a><code><span class="keyword">module </span>Option = Core.Option</code></div><dl><dt class="spec type" id="type-priv"><a href="#type-priv" class="anchor"></a><code><span class="keyword">type </span>priv</code><code><span class="keyword"> = </span>bytes</code></dt><dt class="spec type" id="type-pub"><a href="#type-pub" class="anchor"></a><code><span class="keyword">type </span>pub</code><code><span class="keyword"> = </span>bytes</code></dt></dl><dl><dt class="spec value" id="val-derive"><a href="#val-derive" class="anchor"></a><code><span class="keyword">val </span>derive : bytes <span>&#45;&gt;</span> bytes</code></dt><dt class="spec value" id="val-import"><a href="#val-import" class="anchor"></a><code><span class="keyword">val </span>import : cipher:string <span>&#45;&gt;</span> pass:string <span>&#45;&gt;</span> bytes option</code></dt><dt class="spec value" id="val-export"><a href="#val-export" class="anchor"></a><code><span class="keyword">val </span>export : priv:bytes <span>&#45;&gt;</span> pass:string <span>&#45;&gt;</span> string</code></dt><dt class="spec value" id="val-show"><a href="#val-show" class="anchor"></a><code><span class="keyword">val </span>show : bytes <span>&#45;&gt;</span> string</code></dt><dt class="spec value" id="val-load"><a href="#val-load" class="anchor"></a><code><span class="keyword">val </span>load : string <span>&#45;&gt;</span> bytes option</code></dt><dt class="spec value" id="val-address"><a href="#val-address" class="anchor"></a><code><span class="keyword">val </span>address : bytes <span>&#45;&gt;</span> string</code></dt><dt class="spec value" id="val-sign"><a href="#val-sign" class="anchor"></a><code><span class="keyword">val </span>sign : priv:bytes <span>&#45;&gt;</span> msg:string <span>&#45;&gt;</span> string</code></dt><dt class="spec value" id="val-verify"><a href="#val-verify" class="anchor"></a><code><span class="keyword">val </span>verify : pub:bytes <span>&#45;&gt;</span> msg:string <span>&#45;&gt;</span> signature:string <span>&#45;&gt;</span> bool</code></dt><dt class="spec value" id="val-__check"><a href="#val-__check" class="anchor"></a><code><span class="keyword">val </span>__check : bytes <span>&#45;&gt;</span> bytes option</code></dt><dt class="spec value" id="val-sign"><a href="#val-sign" class="anchor"></a><code><span class="keyword">val </span>sign : priv:bytes <span>&#45;&gt;</span> msg:string <span>&#45;&gt;</span> string <a href="index.html#module-Option">Option</a>.t</code></dt><dt class="spec value" id="val-import"><a href="#val-import" class="anchor"></a><code><span class="keyword">val </span>import : cipher:string <span>&#45;&gt;</span> pass:string <span>&#45;&gt;</span> bytes <a href="index.html#module-Option">Option</a>.t</code></dt><dt class="spec value" id="val-generate"><a href="#val-generate" class="anchor"></a><code><span class="keyword">val </span>generate : unit <span>&#45;&gt;</span> bytes</code></dt><dt class="spec value" id="val-pair"><a href="#val-pair" class="anchor"></a><code><span class="keyword">val </span>pair : unit <span>&#45;&gt;</span> bytes<span class="keyword"> * </span>bytes</code></dt></dl></div></body></html>
2 changes: 1 addition & 1 deletion docs/apiref/hieroglyphs/Hieroglyphs__/Random/index.html
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Random (hieroglyphs.Hieroglyphs__.Random)</title><link rel="stylesheet" href="../../../odoc.css"/><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><script src="../../../highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body><div class="content"><header><nav><a href="../index.html">Up</a> – <a href="../../index.html">hieroglyphs</a> &#x00BB; <a href="../index.html">Hieroglyphs__</a> &#x00BB; Random</nav><h1>Module <code>Hieroglyphs__.Random</code></h1></header><dl><dt class="spec value" id="val-generate"><a href="#val-generate" class="anchor"></a><code><span class="keyword">val </span>generate : unit <span>&#45;&gt;</span> int64</code></dt></dl></div></body></html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Random (hieroglyphs.Hieroglyphs__.Random)</title><link rel="stylesheet" href="../../../odoc.css"/><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><script src="../../../highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body><div class="content"><header><nav><a href="../index.html">Up</a> – <a href="../../index.html">hieroglyphs</a> &#x00BB; <a href="../index.html">Hieroglyphs__</a> &#x00BB; Random</nav><h1>Module <code>Hieroglyphs__.Random</code></h1></header><dl><dt class="spec value" id="val-generate512"><a href="#val-generate512" class="anchor"></a><code><span class="keyword">val </span>generate512 : unit <span>&#45;&gt;</span> bytes</code></dt></dl></div></body></html>
Loading