changes and updated benchmark
This commit is contained in:
parent
784d7001e0
commit
f12522f869
BIN
ed25519.dll
BIN
ed25519.dll
Binary file not shown.
13
readme.md
13
readme.md
|
@ -20,14 +20,15 @@ Performance
|
|||
On a Windows machine with an Intel Pentium B970 @ 2.3GHz I got the following
|
||||
speeds (running on only one a single core):
|
||||
|
||||
Seed + key generation: 489us
|
||||
Message signing (short message): 251us
|
||||
Message verifying (short message): 772us
|
||||
Scalar addition: 358us
|
||||
Key exchange: 724us
|
||||
Seed + key generation: 144us
|
||||
Message signing (short message): 87us
|
||||
Message verifying (short message): 228us
|
||||
Scalar addition: 100us
|
||||
Key exchange: 220us
|
||||
|
||||
The speeds on other machines may vary. Sign/verify times will be higher with
|
||||
longer messages.
|
||||
longer messages. The implementation significantly benefits from 64 bit
|
||||
architectures, if possible compile as 64 bit.
|
||||
|
||||
|
||||
Usage
|
||||
|
|
|
@ -10,7 +10,7 @@ void ed25519_add_scalar(unsigned char *public_key, unsigned char *private_key, c
|
|||
unsigned char n[32];
|
||||
ge_p3 nB;
|
||||
ge_p1p1 A_p1p1;
|
||||
ge_p3 A;
|
||||
ge_p2 A;
|
||||
ge_p3 public_key_unpacked;
|
||||
ge_cached T;
|
||||
|
||||
|
@ -39,9 +39,9 @@ void ed25519_add_scalar(unsigned char *public_key, unsigned char *private_key, c
|
|||
|
||||
/* A = n*B + T */
|
||||
ge_add(&A_p1p1, &nB, &T);
|
||||
ge_p1p1_to_p3(&A, &A_p1p1);
|
||||
ge_p1p1_to_p2(&A, &A_p1p1);
|
||||
|
||||
/* pack public key */
|
||||
ge_p3_tobytes(public_key, &A);
|
||||
ge_tobytes(public_key, &A);
|
||||
}
|
||||
}
|
||||
|
|
4
test.c
4
test.c
|
@ -116,7 +116,7 @@ int main(int argc, char *argv[]) {
|
|||
}
|
||||
end = clock();
|
||||
|
||||
printf("%fus per signature\n", ((double) ((end - start) * 1000)) / CLOCKS_PER_SEC / i * 1000);
|
||||
printf("%fus per keypair\n", ((double) ((end - start) * 1000)) / CLOCKS_PER_SEC / i * 1000);
|
||||
|
||||
printf("testing key exchange performance: ");
|
||||
start = clock();
|
||||
|
@ -125,7 +125,7 @@ int main(int argc, char *argv[]) {
|
|||
}
|
||||
end = clock();
|
||||
|
||||
printf("%fus per signature\n", ((double) ((end - start) * 1000)) / CLOCKS_PER_SEC / i * 1000);
|
||||
printf("%fus per shared secret\n", ((double) ((end - start) * 1000)) / CLOCKS_PER_SEC / i * 1000);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue