-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbench.h
71 lines (58 loc) · 1.61 KB
/
bench.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/*
* This file is part of John the Ripper password cracker,
* Copyright (c) 1996-99,2006,2009,2011,2012,2017 by Solar Designer
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted.
*
* There's ABSOLUTELY NO WARRANTY, express or implied.
*/
/*
* Cracking algorithm benchmark.
*/
#ifndef _JOHN_BENCH_H
#define _JOHN_BENCH_H
#include <stdint.h>
#include <time.h>
#include "arch.h"
#include "formats.h"
/*
* Structure used to return benchmark results.
*/
struct bench_results {
/* Elapsed real and processor time */
clock_t real, virtual;
/* Number of ciphertexts computed */
uint64_t crypts;
};
/*
* Clock ticks per second - either as obtained via sysconf(_SC_CLK_TCK)
* or the constant CLK_TCK.
*/
extern long clk_tck;
/*
* Initializes clk_tck on the first invocation; does nothing afterwards.
*/
extern void clk_tck_init(void);
/*
* Benchmark time in seconds (per cracking algorithm).
*/
extern unsigned int benchmark_time;
/*
* Benchmarks the supplied cracking algorithm. Returns NULL on success,
* an error message if the self-test fails or there are no test vectors
* for this algorithm, or an empty string if aborted.
*/
extern char *benchmark_format(struct fmt_main *format, int salts,
struct bench_results *results);
/*
* Converts benchmarked c/s into an ASCII string.
*/
extern void benchmark_cps(uint64_t crypts, clock_t time, char *buffer);
/*
* Benchmarks all the registered cracking algorithms and prints the results
* to stdout. Returns zero on success, non-zero if any tests failed or were
* aborted.
*/
extern int benchmark_all(void);
#endif