-
Notifications
You must be signed in to change notification settings - Fork 2
/
oclhcbench
executable file
·109 lines (94 loc) · 2.23 KB
/
oclhcbench
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#!/bin/bash
# (c) 2020 Leif Sawyer
# License: GPL 3.0 (see https://github.com/akhepcat/)
# Permanent home: https://github.com/akhepcat/Miscellaneous/
# Direct download: https://raw.githubusercontent.com/akhepcat/Miscellaneous/master/oclhcbench
#
MODES=(0 100 500 1000 1400 1500 1700 1800 2500 3000 3200 5500 5600 6211 6800 7100 7500 11300 11600 12500 13000 13100 13400 15300 15900 18100 18900)
#
# You can easily parse and import using:
#
# $ oclhcbench | oclhcbench2csv > oclhcbench.csv
#
GROUP=0
ONEHIT=0
FORCE=""
WL=3 # we used to use 4, but maybe that was a bad idea; it's crashing my test box at home, oops
ARG="${*}"
if [ -n "$ARG" ]
then
if [ -z "${ARG##*single*}" ]
then
ONEHIT=1
fi
if [ -z "${ARG##*group*}" ]
then
GROUP=1
fi
if [ -z "${ARG##*force*}" ]
then
FORCE="--force"
fi
fi
if [ $ONEHIT -eq 1 -a $GROUP -eq 1 ]
then
echo "only one of 'single' or 'group' may be selected"
exit 1
fi
tmpfile=$(mktemp)
hashcat ${FORCE} -I 2>&1 > ${tmpfile}
declare -A devices
plid=0
did=0
idx=0
while read line
do
if [ -n "${line}" -a -z "${line##Platform ID*}" ]
then
plid=${line//Platform ID #/}
elif [ -n "${line}" -a -z "${line##OpenCL Platform ID*}" ]
then
plid=${line//OpenCL Platform ID #/}
else
# Backend Device ID #2 (Alias: #1)
#or
# Backend Device ID #3
#or
# Device ID #2
if [ -n "${line}" -a -z "${line##*Device ID*}" ]
then
did=${line//*Device ID #/}
did=${did// */}
idx="${plid}-${did}"
devices[$idx]=1
fi
fi
done < "${tmpfile}"
echo "finished parsing OCL devices"
rm -f "${tmpfile}"
if [ ${GROUP:-0} -eq 0 ]
then
for key in "${!devices[@]}"
do
if [ ${devices[$key]} -eq 1 ]
then
didx=${key#*-}
dtype=${key%-*}
PLAT="-D 1,2"
if [ ${ONEHIT} -eq 0 ];
then
hashcat --workload-profile=${WL} ${FORCE} ${PLAT} -d ${didx} --benchmark 2>&1
else
for idx in "${!MODES[@]}"
do
hashcat --workload-profile=${WL} ${FORCE} ${PLAT} -d ${didx} --benchmark -m ${MODES[$idx]} 2>&1
done
fi
fi
done
else
for idx in "${!MODES[@]}"
do
hashcat --workload-profile=${WL} ${FORCE} --opencl-device-types=1,2,3 --benchmark -m ${MODES[$idx]} 2>&1
done
fi