1#!/usr/local/bin/perl
2#
3# John the Ripper benchmark output conversion tool, revision 1
4# Copyrigth (c) 2012, Frank Dittrich
5# Some code might be borrowed from the relbench script,
6# Copyright (2) 2011 Solar Designer, because the code has
7# originally been added as a patch to relbench.
8#
9# Redistribution and use in source and binary forms, with or without
10# modification, are permitted.  (This is a heavily cut-down "BSD license".)
11#
12# The script is used to unify the benchmark (./john --test) output
13# of different John the Ripper versions (official or Jumbo)
14# so that the format names match those used in the newest (Jumbo) version.
15#
16# This allows to use two files with benchmark output to be used
17# with relbench.
18#
19# This Perl script reads "john --test" benchmark output from STDIN
20# and writes the converted benchmark output to STDOUT.
21#
22# You can either use
23#
24# ./john --test > benchmark-orig.txt
25#
26# ./benchmark-unify < benchmark-orig.txt > benchmark-converted.txt
27#
28# Or, you can use
29#
30# ./john --test | ./benchmark-unify > benchmark-converted.txt
31#
32# in case you don't need the original file
33#
34# If you want to create a file with benchmark output and see the
35# benchmark output on the screen while the benchmark runs, you can
36# also use
37#
38# ./john --test | ./benchmark-unify | tee benchmark-converted.txt
39#
40# Two of those converted benchmark output files can be used with
41# relbench, usually resulting in a higher number of matching
42# format names which allow to compare the benchmark results
43# of different benchmark runs.
44
45use warnings;
46
47sub parse
48{
49	chomp;
50	# john-1.7.6-jumbo-12 still used md5_gen(n) instead of dynamic_n
51	s/^Benchmarking: +md5_gen\(([0-9]+)\):? +/Benchmarking: dynamic_$1: /;
52	s/^(Benchmarking: dynamic_[0-9]+):? ([^[]+)\[/$1 [$2/;
53	($name,$end) = /^Benchmarking: ([^\[]*[^ ]) +(\[.*\].*)$/;
54	#print "name=[$name] end=[$end]\n";
55	if (defined($name) && defined($end)) {
56		$name =~ s/\s+/ /g;
57		$end =~ s/\s+/ /g;
58		if (defined($renamed{$name})) {
59			$name = $renamed{$name};
60		}
61		print "Benchmarking: $name $end\n";
62	}
63	else {
64		print "$_\n";
65	}
66}
67
68$_ = '';
69
70while(<DATA>) {
71	chomp;
72	($old_format, $new_format) = /^(.*)	(.*)$/;
73	if(defined($new_format) && defined($old_format)) {
74		# FIXME: Should I check that no format name appears
75		#        both as an old name and as a new name?
76		#        I don't want to map
77		#        old -> new -> even newer
78		#        or old -> new and new -> old
79		$renamed{$old_format} = $new_format;
80	}
81}
82
83$_ = '';
84
85while (<>) {
86	parse();
87}
88
89# Mapping old format names to new ones, separated by \t
90# old	new
91# Currently not mapped john-1.7.9-jumbo-5 format names:
92#
93# HMAC MD5	HMAC MD5
94# format name unchanged, but benchmark changed from Raw: to
95# Only one salt: / Many salts:
96#
97# ssh	SSH RSA/DSA
98# test vector has changed: (one 2048-bit RSA and one 1024-bit DSA key)
99#
100# For readability, please keep this list sorted by old format name
101# (ignoring case, so use sort -f or sort --ignore-case, please)
102__DATA__
103bf-opencl, OpenBSD Blowfish (x32)	bcrypt-opencl ("$2a$05", 32 iterations)
104blackberry-es10	Blackberry-ES10 (101x)
105BSDI DES (x725)	bsdicrypt, BSDI crypt(3) ("_J9..", 725 iterations)
106chap, iSCSI CHAP authentication	chap, iSCSI CHAP authentication / EAP-MD5
107Cisco PIX MD5	pix-md5, Cisco PIX
108CRC-32	CRC32
109crypt-MD5	md5crypt, crypt(3) $1$
110DIGEST-MD5	dmd5, DIGEST-MD5 C/R
111DIGEST-MD5 C/R	dmd5, DIGEST-MD5 C/R
112Django PBKDF2-HMAC-SHA-256 (x10000)	Django (x10000)
113DragonFly BSD $3$ SHA-256 w/ bug, 32-bit	dragonfly3-32, DragonFly BSD $3$ w/ bug, 32-bit
114DragonFly BSD $3$ SHA-256 w/ bug, 64-bit	dragonfly3-64, DragonFly BSD $3$ w/ bug, 64-bit
115DragonFly BSD $4$ SHA-512 w/ bugs, 32-bit	dragonfly4-32, DragonFly BSD $4$ w/ bugs, 32-bit
116DragonFly BSD $4$ SHA-512 w/ bugs, 64-bit	dragonfly4-64, DragonFly BSD $4$ w/ bugs, 64-bit
117Drupal 7 $S$ SHA-512 (x16385)	Drupal7, $S$ (x16385)
118eCryptfs	eCryptfs (65536x)
119Eggdrop	bfegg, Eggdrop
120Eggdrop Blowfish	bfegg, Eggdrop
121encfs-opencl, EncFS	EncFS-opencl
122EPiServer salted SHA-1/SHA-256	EPiServer
123EPiServer SID Hashes	EPI, EPiServer SID
124EPiServer SID salted SHA-1	EPI, EPiServer SID
125FreeBSD MD5	md5crypt, crypt(3) $1$
126generic crypt(3)	crypt, generic crypt(3)
127generic crypt(3) DES	crypt, generic crypt(3)
128Generic salted MD4	md4-gen, Generic salted MD4
129Generic salted SHA-1	sha1-gen, Generic salted SHA-1
130GOST R 34.11-94	gost, GOST R 34.11-94
131HalfLM C/R DES	nethalflm, HalfLM C/R
132HMAC MD5	HMAC-MD5
133HMAC SHA-1	HMAC-SHA1
134HMAC SHA-224	HMAC-SHA224
135HMAC SHA-256	HMAC-SHA256
136HMAC SHA-384	HMAC-SHA384
137HMAC SHA-512	HMAC-SHA512
138hmailserver	hMailServer
139hMailServer salted SHA-256	hMailServer
140srp, "MD5 authentication" HSRP, VRRP, GLBP	hsrp, "MD5 authentication" HSRP, HSRPv2, VRRP, GLBP
141HTTP Digest access authentication	hdaa, HTTP Digest access authentication
142HTTP Digest access authentication MD5	hdaa, HTTP Digest access authentication
143Invision Power Board 2.x salted MD5	ipb2, Invision Power Board 2.x
144IPB2 MD5	ipb2, Invision Power Board 2.x
145KeePass SHA-256 AES	KeePass
146Kerberos 5 db etype 18 aes256-cts-hmac-sha1-96	krb5-18, Kerberos 5 DB etype 18
147Kerberos AFS DES	AFS, Kerberos AFS
148Kerberos v4 TGT	krb4, Kerberos v4 TGT
149Kerberos v4 TGT DES	krb4, Kerberos v4 TGT
150Kerberos v5 TGT	krb5, Kerberos v5 TGT
151Kerberos v5 TGT 3DES	krb5, Kerberos v5 TGT
152KRB5 aes256-cts-hmac-sha1-96	krb5-18, Kerberos 5 DB etype 18
153KRB5 arcfour-hmac	Kerberos 5 db etype 23 rc4-hmac
154krb5-18, Kerberos 5 db etype 18 aes256-cts-hmac-sha1-96	krb5-18, Kerberos 5 DB etype 18
155LM C/R DES	netlm, LM C/R
156LM DES	LM
157LMv2 C/R MD4	netlmv2, LMv2 C/R
158LMv2 C/R MD4 HMAC-MD5	netlmv2, LMv2 C/R
159Lotus Notes/Domino 5	lotus5, Lotus Notes/Domino 5
160Lotus Notes/Domino 6 More Secure Internet Password	dominosec, Lotus Notes/Domino 6 More Secure Internet Password
161Lotus5	lotus5, Lotus Notes/Domino 5
162M$ Cache Hash	mscash, MS Cache Hash (DCC)
163M$ Cache Hash (DCC) MD4	mscash, MS Cache Hash (DCC)
164M$ Cache Hash 2 (DCC2)	mscash2, MS Cache Hash 2 (DCC2)
165M$ Cache Hash 2 (DCC2) PBKDF2-HMAC-SHA-1	mscash2, MS Cache Hash 2 (DCC2)
166M$ Cache Hash MD4	mscash, MS Cache Hash (DCC)
167Mac OS X 10.4 - 10.6 salted SHA-1	xsha, Mac OS X 10.4 - 10.6
168Mac OS X 10.7+ salted SHA-512	xsha512, Mac OS X 10.7
169Mac OS X Keychain PBKDF2-HMAC-SHA-1 3DES	keychain, Mac OS X Keychain
170md5(unicode($p))	Raw-MD5u
171MediaWiki -- md5($s.'-'.md5($p))	MediaWiki
172MediaWiki md5($s.'-'.md5($p))	MediaWiki
173More Secure Internet Password	Lotus Notes/Domino 6 More Secure Internet Password
174Mozilla SHA-1 3DES	Mozilla (key3.db) SHA-1 3DES
175MS Kerberos 5 AS-REQ Pre-Auth	krb5pa-md5, Kerberos 5 AS-REQ Pre-Auth etype 23
176MS Kerberos 5 AS-REQ Pre-Auth MD4 MD5 RC4	krb5pa-md5, Kerberos 5 AS-REQ Pre-Auth etype 23
177MS SQL 2005 SHA-1	mssql05, MS SQL 2005
178MS SQL SHA-1	mssql, MS SQL
179MS-SQL	mssql, MS SQL
180MS-SQL05	mssql05, MS SQL 2005
181MSCHAPv2 C/R MD4 DES	MSCHAPv2, C/R
182mschapv2-naive, MSCHAPv2 C/R	MSCHAPv2, C/R
183MySQL	mysql, MySQL pre-4.1
184MySQL 4.1 double-SHA-1	mysql-sha1, MySQL 4.1+
185MySQL 4.1+ double-SHA-1	mysql-sha1, MySQL 4.1+
186MySQL pre-4.1	mysql, MySQL pre-4.1
187MYSQL_fast	mysql, MySQL pre-4.1
188netntlm-naive, NTLMv1 C/R	netntlmv2, NTLMv2 C/R
189Netscape LDAP SHA	nsldap, Netscape LDAP {SHA}
190Netscape LDAP SHA-1	nsldap, Netscape LDAP {SHA}
191Netscreen MD5	md5ns, Netscreen
192NT MD4	NT
193NT v2	NT
194NT-old	NT
195nt-opencl, NT	NT-opencl
196NTLMv1 C/R MD4 DES	netntlm, NTLMv1 C/R
197NTLMv1 C/R MD4 DES (ESS MD5)	netntlm, NTLMv1 C/R
198NTLMv2 C/R MD4 HMAC-MD5	netntlmv2, NTLMv2 C/R
199ODF SHA-1 Blowfish	ODF
200ODF SHA-1 Blowfish / SHA-256 AES	ODF
201Office 2007/2010 (SHA-1) / 2013 (SHA-512), with AES	Office, 2007/2010 (SHA-1) / 2013 (SHA-512), with AES
202Office 2007/2010 SHA-1/AES	Office, 2007/2010 (SHA-1) / 2013 (SHA-512), with AES
203Office, 2007/201/2013	Office, 2007/2010 (SHA-1) / 2013 (SHA-512), with AES
204OpenBSD Blowfish (x32)	bcrypt ("$2a$05", 32 iterations)
205Oracle	oracle, Oracle 10
206Oracle 10 DES	oracle, Oracle 10
207Oracle 11g	oracle11, Oracle 11g
208Oracle 11g SHA-1	oracle11, Oracle 11g
209osCommerce md5($salt.$pass)	osc, osCommerce
210Password Safe SHA-256	pwsafe, Password Safe
211pbkdf2-hmac-sha512-opencl, GRUB2 / OS X 10.8+, rounds=10000	PBKDF2-HMAC-SHA512-opencl, GRUB2 / OS X 10.8+
212pdf	PDF
213PDF MD5 RC4	PDF
214PDF MD5 SHA-2 RC4 / AES	PDF
215PFX, PKCS12	pfx
216PHPass MD5	phpass ($P$9)
217phpass MD5 ($P$9)	phpass ($P$9)
218phpass-opencl ($P$9 lengths 0 to 15)	PHPass-opencl ($P$9)
219PHPS -- md5(md5($pass).$salt)	PHPS
220PHPS md5(md5($pass).$salt)	PHPS
221PIX MD5	pix-md5, Cisco PIX
222pkzip	PKZIP
223Post.Office MD5	po, Post.Office
224PuTTY, Private Key	PuTTY, Private Key (RSA/DSA/ECDSA/ED25519)
225RACF DES	RACF
226rar	rar, RAR3 (4 characters)
227RAR3 SHA-1 AES (4 characters)	rar, RAR3 (4 characters)
228Raw MD4	Raw-MD4
229Raw MD5	Raw-MD5
230Raw SHA	Raw-SHA, "SHA-0"
231Raw SHA-0	Raw-SHA, "SHA-0"
232Raw SHA-1	Raw-SHA1
233Raw SHA-1 LinkedIn	Raw-SHA1-Linkedin
234Raw SHA-224	Raw-SHA224
235Raw SHA-256	Raw-SHA256
236Raw SHA-384	Raw-SHA384
237Raw SHA-512	Raw-SHA512
238Raw-SHA256-ng	Raw-SHA256
239Raw-SHA512-ng	Raw-SHA512
240rsvp, HMAC-MD5 / HMAC-SHA1, RSVP, IS-IS	rsvp, HMAC-MD5 / HMAC-SHA1, RSVP, IS-IS, OMAPI, RNDC, TSIG
241Salted SHA-1	Salted-SHA1
242SAP BCODE	sapb, SAP CODVN B (BCODE)
243SAP CODVN B (BCODE)	sapb, SAP CODVN B (BCODE)
244SAP CODVN F/G (PASSCODE)	sapg, SAP CODVN F/G (PASSCODE)
245SAP CODVN G (PASSCODE)	sapg, SAP CODVN F/G (PASSCODE)
246sha256crypt (rounds=5000)	sha256crypt, crypt(3) $5$ (rounds=5000)
247sha512crypt (rounds=5000)	sha512crypt, crypt(3) $6$ (rounds=5000)
248SIP MD5	SIP
249SSH RSA/DSA (one 2048-bit RSA and one 1024-bit DSA key)	SSH (one 2048-bit RSA and one 1024-bit DSA key)
250strip-opencl, STRIP Password Manager	strip-opencl, Password Manager
251sxc, StarOffice .sxc	ODF, OpenDocument Star/Libre/OpenOffice
252sxc-opencl, StarOffice .sxc	ODF-opencl, OpenDocument Star/Libre/OpenOffice
253Sybase ASE salted SHA-256	SybaseASE, Sybase ASE
254sybasease, Sybase ASE	SybaseASE, Sybase ASE
255sybasease	sybasease, Sybase ASE
256tc_aes_xts, TrueCrypt (RIPEMD160/SHA512/WHIRLPOOL) AES256_XTS	tc_aes_xts, TrueCrypt AES256_XTS
257tc_ripemd160, TrueCrypt RIPEMD160 AES256_XTS	tc_ripemd160, TrueCrypt AES256_XTS
258tc_sha512, TrueCrypt SHA512 AES256_XTS	tc_sha512, TrueCrypt AES256_XTS
259tc_whirlpool, TrueCrypt WHIRLPOOL AES256_XTS	tc_whirlpool, TrueCrypt AES256_XTS
260tcp-md5, TCP MD5 Signatures, BGP	tcp-md5, TCP MD5 Signatures, BGP, MSDP
261Traditional DES	descrypt, traditional crypt(3)
262Tripcode DES	tripcode
263VNC DES	VNC
264WinZip PBKDF2-HMAC-SHA-1	ZIP, WinZip
265WoltLab BB3 salted SHA-1	wbb3, WoltLab BB3
266WPA-PSK PBKDF2-HMAC-SHA-1	wpapsk, WPA/WPA2/PMF/PMKID PSK
267WPA/WPA2 PSK PBKDF2-HMAC-SHA-1	wpapsk, WPA/WPA2/PMF/PMKID PSK
268wpapsk, WPA/WPA2 PSK	wpapsk, WPA/WPA2/PMF/PMKID PSK
269wpapsk-opencl, WPA/WPA2 PSK	wpapsk-opencl, WPA/WPA2/PMF/PMKID PSK
270zip	ZIP, WinZip
271zip-opencl, ZIP	ZIP-opencl, WinZip
272