mirror of
https://github.com/Rate-Limiting-Nullifier/rln-docs.git
synced 2026-01-08 23:08:09 -05:00
deploy: b6675b686f
This commit is contained in:
@@ -214,16 +214,17 @@
|
||||
<div style="break-before: page; page-break-before: always;"></div><h1 id="usage"><a class="header" href="#usage">Usage</a></h1>
|
||||
<div style="break-before: page; page-break-before: always;"></div><h1 id="theory"><a class="header" href="#theory">Theory</a></h1>
|
||||
<div style="break-before: page; page-break-before: always;"></div><h1 id="shamirs-secret-sharing-scheme"><a class="header" href="#shamirs-secret-sharing-scheme">Shamirs Secret Sharing Scheme</a></h1>
|
||||
<p><em>Shamirs Secret Sharing</em> allows to split the secret to <code>n</code> parts and restore it upon presentation any <code>m</code> parts (<code>m <= n</code>)</p>
|
||||
<p><a href="https://en.wikipedia.org/wiki/Shamir%27s_Secret_Sharing">Sharmir's Secret Sharing wikipedia</a> is a good reference to understand the concept.</p>
|
||||
<p>Reconstruction 1: https://github.com/akinovak/semaphore-lib/blob/5b9bb3210192c8e508eced7ef6579fd56e635ed0/src/rln.ts#L31</p>
|
||||
<pre><code class="language-rs">retrievePrivateKey(x1: bigint, x2:bigint, y1:bigint, y2:bigint): Buffer | ArrayBuffer {
|
||||
<pre><code class="language-js">retrievePrivateKey(x1: bigint, x2:bigint, y1:bigint, y2:bigint): Buffer | ArrayBuffer {
|
||||
const slope = Fq.div(Fq.sub(y2, y1), Fq.sub(x2, x1))
|
||||
const privateKey = Fq.sub(y1, Fq.mul(slope, x1));
|
||||
return bigintConversion.bigintToBuf(Fq.normalize(privateKey));
|
||||
}
|
||||
</code></pre>
|
||||
<p>Reconstruction 2: https://github.com/akinovak/semaphore-lib/blob/rln_signature_changes/test/index.ts#L250</p>
|
||||
<pre><code class="language-rs">async function testRlnSlashingSimulation() {
|
||||
<pre><code class="language-js">async function testRlnSlashingSimulation() {
|
||||
RLN.setHasher('poseidon');
|
||||
const identity = RLN.genIdentity();
|
||||
const privateKey = identity.keypair.privKey;
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
5
sss.html
5
sss.html
@@ -135,16 +135,17 @@
|
||||
<div id="content" class="content">
|
||||
<main>
|
||||
<h1 id="shamirs-secret-sharing-scheme"><a class="header" href="#shamirs-secret-sharing-scheme">Shamirs Secret Sharing Scheme</a></h1>
|
||||
<p><em>Shamirs Secret Sharing</em> allows to split the secret to <code>n</code> parts and restore it upon presentation any <code>m</code> parts (<code>m <= n</code>)</p>
|
||||
<p><a href="https://en.wikipedia.org/wiki/Shamir%27s_Secret_Sharing">Sharmir's Secret Sharing wikipedia</a> is a good reference to understand the concept.</p>
|
||||
<p>Reconstruction 1: https://github.com/akinovak/semaphore-lib/blob/5b9bb3210192c8e508eced7ef6579fd56e635ed0/src/rln.ts#L31</p>
|
||||
<pre><code class="language-rs">retrievePrivateKey(x1: bigint, x2:bigint, y1:bigint, y2:bigint): Buffer | ArrayBuffer {
|
||||
<pre><code class="language-js">retrievePrivateKey(x1: bigint, x2:bigint, y1:bigint, y2:bigint): Buffer | ArrayBuffer {
|
||||
const slope = Fq.div(Fq.sub(y2, y1), Fq.sub(x2, x1))
|
||||
const privateKey = Fq.sub(y1, Fq.mul(slope, x1));
|
||||
return bigintConversion.bigintToBuf(Fq.normalize(privateKey));
|
||||
}
|
||||
</code></pre>
|
||||
<p>Reconstruction 2: https://github.com/akinovak/semaphore-lib/blob/rln_signature_changes/test/index.ts#L250</p>
|
||||
<pre><code class="language-rs">async function testRlnSlashingSimulation() {
|
||||
<pre><code class="language-js">async function testRlnSlashingSimulation() {
|
||||
RLN.setHasher('poseidon');
|
||||
const identity = RLN.genIdentity();
|
||||
const privateKey = identity.keypair.privKey;
|
||||
|
||||
Reference in New Issue
Block a user