-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add jets for luck:ed, sign-raw:ed, sign-raw-octs:ed, scad:ed, scas:ed…
…, scap:ed (#748) - luck:ed and sign-(octs-)raw go together - luck:ed generates a public private keypair where the private keypair is generated from SHA512(seed) and the usual EdDSA clamping procedure is done on the first 32 bytes. - sign-(octs-)raw allows one to sign from a keypair generated with luck (or, from sca(d/s)) - scad, scas, scap allows one to 'tweak' a public/private keypair with a scalar - scad tweaks public and private - scas tweaks private - scap tweaks public
- Loading branch information
Showing
18 changed files
with
642 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/// @file | ||
|
||
#include "jets/q.h" | ||
#include "jets/w.h" | ||
|
||
#include "noun.h" | ||
#include "urcrypt.h" | ||
|
||
static u3_atom | ||
_cqee_luck(u3_atom sed) | ||
{ | ||
c3_y sed_y[32]; | ||
|
||
if ( 0 != u3r_bytes_fit(32, sed_y, sed) ) { | ||
// hoon explicitly crashes on mis-size | ||
return u3m_bail(c3__exit); | ||
} | ||
else { | ||
c3_y pub_y[32]; | ||
c3_y sec_y[64]; | ||
urcrypt_ed_luck(sed_y, pub_y, sec_y); | ||
return u3nc(u3i_bytes(32, pub_y), u3i_bytes(64, sec_y)); | ||
} | ||
} | ||
|
||
u3_noun | ||
u3wee_luck(u3_noun cor) | ||
{ | ||
u3_noun a = u3r_at(u3x_sam, cor); | ||
|
||
if ( (u3_none == a) || (c3n == u3ud(a)) ) { | ||
return u3m_bail(c3__exit); | ||
} | ||
else { | ||
return _cqee_luck(a); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/// @file | ||
|
||
#include "jets/q.h" | ||
#include "jets/w.h" | ||
|
||
#include "noun.h" | ||
#include "urcrypt.h" | ||
|
||
|
||
static u3_atom | ||
_cqee_point_neg(u3_atom a) | ||
{ | ||
c3_y a_y[32]; | ||
|
||
if ( (0 != u3r_bytes_fit(32, a_y, a)) || | ||
(0 != urcrypt_ed_point_neg(a_y)) ) { | ||
return u3m_bail(c3__exit); | ||
} | ||
else { | ||
return u3i_bytes(32, a_y); | ||
} | ||
} | ||
|
||
u3_noun | ||
u3wee_point_neg(u3_noun cor) | ||
{ | ||
|
||
u3_noun a; | ||
|
||
if ( (u3_none == (a = u3r_at(u3x_sam, cor))) || | ||
(c3n == u3ud(a)) ) | ||
{ | ||
return u3m_bail(c3__exit); | ||
} else { | ||
return _cqee_point_neg(a); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/// @file | ||
|
||
#include "jets/q.h" | ||
#include "jets/w.h" | ||
|
||
#include "noun.h" | ||
#include "urcrypt.h" | ||
|
||
// `@ux`(rev 3 32 l:ed:crypto) | ||
static c3_y _cqee_l_prime[] = { | ||
0xed, 0xd3, 0xf5, 0x5c, 0x1a, 0x63, 0x12, 0x58, | ||
0xd6, 0x9c, 0xf7, 0xa2, 0xde, 0xf9, 0xde, 0x14, | ||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, | ||
}; | ||
|
||
u3_atom | ||
u3qee_recs(u3_atom a) | ||
{ | ||
c3_w met_w = u3r_met(3, a); | ||
|
||
if ( 64 < met_w ) { | ||
u3_atom l_prime = u3i_bytes(32, _cqee_l_prime); | ||
u3_atom pro = u3qa_mod(a, l_prime); | ||
u3z(l_prime); | ||
return pro; | ||
} | ||
|
||
c3_y a_y[64]; | ||
|
||
u3r_bytes(0, 64, a_y, a); | ||
urcrypt_ed_scalar_reduce(a_y); | ||
return u3i_bytes(32, a_y); | ||
} | ||
|
||
u3_noun | ||
u3wee_recs(u3_noun cor) | ||
{ | ||
u3_noun a; | ||
|
||
if ( (u3_none == (a = u3r_at(u3x_sam, cor))) || | ||
(c3n == u3ud(a)) ) | ||
{ | ||
return u3m_bail(c3__exit); | ||
} else { | ||
return u3qee_recs(a); | ||
} | ||
} |
Oops, something went wrong.