<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
    <title>Belenios Tool</title>
    <script src="tool_js.js"></script>
  </head>
  <body>
    <h1>Belenios Tool</h1>
    <ul>
      <li><a href="#tests">Unit tests</a></li>
      <li><a href="#setup">Pre-election setup</a></li>
      <li><a href="#method-schulze">Condorcet-Schulze method</a></li>
      <li><a href="#buggy-pd">Partial decryption of buggy election</a></li>
    </ul>
    <div id="tests">
      <h2>Tests and benchmarks</h2>
      <div>
        <button id="do_unit_tests">Run unit tests</button>
        <button id="bench_powm">Bench modular exponentiation</button>
      </div>
      <div>
        <select id="bench_group_group" value="Ed25519">
          <option>Ed25519</option>
          <option>BELENIOS-2048</option>
          <option>RFC-3526-2048</option>
        </select>
        <input id="bench_group_nb" value="1000"></input>
        <button id="bench_group">Bench group exponentiation</button>
      </div>
      <div>
        <input id="bench_pbkdf2_nb" value="1000"></input>
        <button id="bench_pbkdf2">Bench PBKDF2</button>
      </div>
    </div>
    <div id="setup">
      <h2>Pre-election setup</h2>
      <div>
        <div>
          UUID:
          <div><textarea id="election_uuid" rows="1" cols="80"></textarea><button id="new_uuid">Generate</button></div>
        </div>
        <div>
          Version:
          <div><textarea id="version" rows="1" cols="80">1</textarea></div>
        </div>
        <div>
          Group parameters:
          <div><textarea id="election_group" rows="1" cols="80">Ed25519</textarea></div>
        </div>
      </div>
    </div>
    <div id="credgen">
      <h3>Credential management</h3>
      <div>
        <h4>Generate anonymous credentials</h4>
        Number of credentials to generate:
        <div><textarea id="credgen_number"></textarea></div>
        <button id="do_credgen_generate">Generate</button>
      </div>
      <div>
        <h4>Generate credentials with identity matching</h4>
        <div>
          List of identities:
          <div><textarea id="credgen_ids"></textarea></div>
        </div>
        <button id="do_credgen_ids">Generate</button>
      </div>
      <div>
        <h4>Generated private credentials</h4>
        <textarea id="credgen_generated_creds" readonly="readonly"></textarea>
      </div>
      <div>
        <h4>Generated public credentials</h4>
        <textarea id="credgen_generated_pks" readonly="readonly"></textarea>
      </div>
      <div>
        <h4>Check a credential</h4>
        <div>
          Credential:
          <div><textarea id="credgen_derive_input"></textarea></div>
          <button id="do_credgen_derive">Generate public key</button>
        </div>
        <div>
          <textarea id="credgen_derive_output" rows="1" cols="80" readonly="readonly"></textarea>
        </div>
      </div>
    </div>
    <div id="method-schulze">
      <h3>Condorcet-Schulze method</h3>
      <div>
        <div>
          <label for="schulze_raw_plaintext_ballots">Raw plaintext ballots:</label>
          <div><textarea id="schulze_raw_plaintext_ballots" rows="10" cols="80"></textarea></div>
        </div>
        <div>
          <label for="schulze_nchoices">Number of choices:</label>
          <input type="number" id="schulze_nchoices"/>
        </div>
        <div>
          <input type="checkbox" id="schulze_blank" checked/><label for="schulze_blank">Allow blank</label>
        </div>
      </div>
      <div>
        <h4>Output</h4>
        <div>
          <button id="do_schulze">Compute</button>
          <div><textarea id="schulze_output" rows="10" cols="80"></textarea></div>
        </div>
      </div>
    </div>
    <div id="buggy-pd">
      <h3>Partial decryption of buggy election</h3>
      <div>
        <div>
          Access code (part of the URL after hash sign):
          <input id="buggy_pd_hash" size="40"/>
        </div>
        <div>Private key: <input id="buggy_pd_seed" size="40"/></div>
        <div><button id="do_buggy_pd">Compute</button></div>
        <div><textarea id="buggy_pd_output" rows="10" cols="80"></textarea></div>
      </div>
    </div>
  </body>
</html>
