int main()
{
SODIUM_INIT;
- print("Chacha20 ",chacha20() *MULT/DIV,"megabytes per second");
- print("Poly1305 ",poly1305() *MULT/DIV,"megabytes per second");
- print("Auth'd encryption",authenticated()*MULT/DIV,"megabytes per second");
- print("Blake2b ",blake2b() *MULT/DIV,"megabytes per second");
- print("Sha512 ",sha512() *MULT/DIV,"megabytes per second");
- print("Argon2i, 3 passes",argon2i() *MULT/DIV,"megabytes per second");
- print("x25519 ",x25519() /DIV,"exchanges per second");
- print("EdDSA(sign) ",edDSA_sign() /DIV,"signatures per second");
- print("EdDSA(check) ",edDSA_check() /DIV,"checks per second");
+ print("Chacha20 ",chacha20() /DIV,"megabytes per second");
+ print("Poly1305 ",poly1305() /DIV,"megabytes per second");
+ print("Auth'd encryption",authenticated()/DIV,"megabytes per second");
+ print("Blake2b ",blake2b() /DIV,"megabytes per second");
+ print("Sha512 ",sha512() /DIV,"megabytes per second");
+ print("Argon2i, 3 passes",argon2i() /DIV,"megabytes per second");
+ print("x25519 ",x25519() ,"exchanges per second");
+ print("EdDSA(sign) ",edDSA_sign() ,"signatures per second");
+ print("EdDSA(check) ",edDSA_check() ,"checks per second");
printf("\n");
return 0;
}
int main()
{
- print("Chacha20 ",chacha20() *MULT/DIV,"megabytes per second");
- print("Poly1305 ",poly1305() *MULT/DIV,"megabytes per second");
- print("Auth'd encryption",authenticated()*MULT/DIV,"megabytes per second");
- print("Blake2b ",blake2b() *MULT/DIV,"megabytes per second");
- print("Sha512 ",sha512() *MULT/DIV,"megabytes per second");
- print("Argon2i, 3 passes",argon2i() *MULT/DIV,"megabytes per second");
- print("x25519 ",x25519() /DIV,"exchanges per second");
- print("EdDSA(sign) ",edDSA_sign() /DIV,"signatures per second");
- print("EdDSA(check) ",edDSA_check() /DIV,"checks per second");
+ print("Chacha20 ",chacha20() /DIV,"megabytes per second");
+ print("Poly1305 ",poly1305() /DIV,"megabytes per second");
+ print("Auth'd encryption",authenticated()/DIV,"megabytes per second");
+ print("Blake2b ",blake2b() /DIV,"megabytes per second");
+ print("Sha512 ",sha512() /DIV,"megabytes per second");
+ print("Argon2i, 3 passes",argon2i() /DIV,"megabytes per second");
+ print("x25519 ",x25519() ,"exchanges per second");
+ print("EdDSA(sign) ",edDSA_sign() ,"signatures per second");
+ print("EdDSA(check) ",edDSA_check() ,"checks per second");
printf("\n");
return 0;
}
// TODO: provide a user defined buffer size
#define KILOBYTE 1024
-#define MEGABYTE (1024 * KILOBYTE)
-#define SIZE (50 * MEGABYTE)
-#define MULT (SIZE / MEGABYTE)
+#define MEGABYTE 1024 * KILOBYTE
+#define SIZE (256 * KILOBYTE)
+#define DIV (MEGABYTE / SIZE)
static timespec diff(timespec start, timespec end)
{
static u64 speed(timespec duration)
{
-#define DIV 1000 // avoid round errors
static const u64 giga = 1000000000;
- return DIV * giga / (duration.tv_nsec + duration.tv_sec * giga);
+ return giga / (duration.tv_nsec + duration.tv_sec * giga);
}
static void print(const char *name, u64 speed, const char *unit)
duration.tv_nsec = -1; \
duration.tv_sec = 3600 * 24; \
duration.tv_nsec = 0; \
- FOR (i, 0, 10) { \
+ FOR (i, 0, 500) { \
TIMESTAMP(start);
#define TIMING_END \