Skip to content

Commit 3eb9e61

Browse files
andrewkdinhSashan
authored andcommitted
Add evp_hash perftool
Adds a CLI tool that computes hashes using the specified algorithm. Prints out the average time per hash computation after 5 seconds. The tool uses the EVP API by default, but this tool can also use the corresponding deprecated API's. The currently supported algorithms are as follows: SHA1, SHA224, SHA256, SHA384, SHA512. Fixes: openssl/project#1681 Reviewed-by: Neil Horman <[email protected]> Reviewed-by: Saša Nedvědický <[email protected]> (Merged from #58)
1 parent 63358ea commit 3eb9e61

File tree

3 files changed

+465
-0
lines changed

3 files changed

+465
-0
lines changed

README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,3 +195,27 @@ The test program supports options as follows:
195195
-p - port number to use
196196
-t - terse output
197197
```
198+
199+
## evp_hash
200+
201+
Tool that computes hashes using the specified algorithm.
202+
Runs for 5 seconds and prints the average execution time per hash.
203+
Prints out the average time per hash computation.
204+
Three modes of operation:
205+
- deprecated: Use deprecated, legacy API's to do hash (e.g. SHA1_Init)
206+
- evp_isolated: Use EVP API and don't allow shared data between threads
207+
- evp_shared (default): Use EVP API and allow shared data between threads
208+
209+
```
210+
Usage: evp_hash [-h] [-t] [-o operation] [-u update-times] [-a algorithm] thread-count
211+
-h - print this help output
212+
-t - terse output
213+
-o operation - mode of operation. One of [deprecated, evp_isolated, evp_shared] (default: evp_shared)
214+
-u update-times - times to update digest. 1 for one-shot (default: 1)
215+
-a algorithm - One of: [SHA1, SHA224, SHA256, SHA384, SHA512] (default: SHA1)
216+
thread-count - number of threads
217+
```
218+
219+
```sh
220+
evp_hash -u 10 -a SHA512 -o evp_isolated 15
221+
```

source/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,3 +184,6 @@ target_link_libraries(evp_setpeer PRIVATE perf)
184184

185185
add_executable(writeread writeread.c)
186186
target_link_libraries(writeread PRIVATE perf)
187+
188+
add_executable(evp_hash evp_hash.c)
189+
target_link_libraries(evp_hash PRIVATE perf)

0 commit comments

Comments
 (0)