changes and updated benchmark

This commit is contained in:
Orson Peters 2013-03-27 18:12:58 +01:00
parent 784d7001e0
commit f12522f869
4 changed files with 12 additions and 11 deletions

Binary file not shown.

View File

@ -20,14 +20,15 @@ Performance
On a Windows machine with an Intel Pentium B970 @ 2.3GHz I got the following On a Windows machine with an Intel Pentium B970 @ 2.3GHz I got the following
speeds (running on only one a single core): speeds (running on only one a single core):
Seed + key generation: 489us Seed + key generation: 144us
Message signing (short message): 251us Message signing (short message): 87us
Message verifying (short message): 772us Message verifying (short message): 228us
Scalar addition: 358us Scalar addition: 100us
Key exchange: 724us Key exchange: 220us
The speeds on other machines may vary. Sign/verify times will be higher with 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 Usage

View File

@ -10,7 +10,7 @@ void ed25519_add_scalar(unsigned char *public_key, unsigned char *private_key, c
unsigned char n[32]; unsigned char n[32];
ge_p3 nB; ge_p3 nB;
ge_p1p1 A_p1p1; ge_p1p1 A_p1p1;
ge_p3 A; ge_p2 A;
ge_p3 public_key_unpacked; ge_p3 public_key_unpacked;
ge_cached T; ge_cached T;
@ -39,9 +39,9 @@ void ed25519_add_scalar(unsigned char *public_key, unsigned char *private_key, c
/* A = n*B + T */ /* A = n*B + T */
ge_add(&A_p1p1, &nB, &T); ge_add(&A_p1p1, &nB, &T);
ge_p1p1_to_p3(&A, &A_p1p1); ge_p1p1_to_p2(&A, &A_p1p1);
/* pack public key */ /* pack public key */
ge_p3_tobytes(public_key, &A); ge_tobytes(public_key, &A);
} }
} }

4
test.c
View File

@ -116,7 +116,7 @@ int main(int argc, char *argv[]) {
} }
end = clock(); 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: "); printf("testing key exchange performance: ");
start = clock(); start = clock();
@ -125,7 +125,7 @@ int main(int argc, char *argv[]) {
} }
end = clock(); 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; return 0;
} }