Skip to content

Commit

Permalink
testing interpolation on ed25519 ok
Browse files Browse the repository at this point in the history
  • Loading branch information
rdubois-crypto committed Dec 10, 2024
1 parent 009521a commit 14c404e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/libMPC/SCL_ecc.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ export class SCL_ecc
return publicKey;
}
if (this.curve === 'ed25519') {
const publicKey = this.curve.GetBase().multiply(int_from_bytes(scalar_array)); // 'true' for compressed format
return this.curve.PointCompress(publicKey);//the getPublicKey is replaced by a scalar multiplication to be compatible with key aggregation
const publicKey = this.GetBase().multiply(int_from_bytes(scalar_array)); // 'true' for compressed format
return this.PointCompress(publicKey);//the getPublicKey is replaced by a scalar multiplication to be compatible with key aggregation
}

throw new Error('Unsupported curve');
Expand Down
4 changes: 2 additions & 2 deletions src/libMPC/SCL_frost.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ export class SCL_trustedKeyGen
if (this.n<this.min_participants)
return false;
//check secshares.G=pubshares
console.log(this.secshares);
//console.log(this.secshares);

for(let i=0;i<this.n;i++){
let recPub=this.curve.GetBase().multiply(this.secshares[i][1]);
Expand All @@ -166,7 +166,7 @@ export class SCL_FROST{
constructor(curve) {

this.curve=new SCL_ecc(curve);

if (this.curve.curve === 'secp256k1') {
this.order=secp256k1.CURVE.n;
this.RawBytesSize=33;//size of a compressed point with parity, 32bytes+1byte parity
Expand Down
14 changes: 9 additions & 5 deletions src/libMPC/test_frost.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,15 @@ import { SCL_FROST, SCL_trustedKeyGen } from './SCL_frost.mjs';


//random vector generation
function test_randomInterpolate_secret(){
function test_randomInterpolate_secret(Curvename){

let curve=new SCL_ecc('secp256k1');
console.log("/*************************** ");
console.log("Test lagrange interpolation on curve:", Curvename);

let curve=new SCL_ecc(Curvename);
let sk=curve.Get_Random_privateKey();

let dealer=new SCL_trustedKeyGen( 'secp256k1',sk, 12,4);
let dealer=new SCL_trustedKeyGen( Curvename,sk, 12,4);

console.log("Consistency secret/public shares:",dealer.Check_Shares());
//erasing to prove Reed Solomon like recovery of missing shares
Expand Down Expand Up @@ -87,7 +90,6 @@ function test_noncegen()

let res=frost.Nonce_gen_internal(rand_, secshare, pubshare, group_pk, msg, extra_in);

console.log("res:",res, res[0].length);

console.log(expected_secnonce.equals(Buffer.from(res[0].slice(0,64))));
console.log(expected_pubnonce.equals(Buffer.from(res[1])));
Expand All @@ -96,7 +98,9 @@ function test_noncegen()


(async () => {
test_randomInterpolate_secret();
test_randomInterpolate_secret('secp256k1');
test_randomInterpolate_secret('ed25519');

test_aggnonce();
test_noncegen();

Expand Down

0 comments on commit 14c404e

Please sign in to comment.