[GH-ISSUE #2278] Should --cost items be audited #1527

Open
opened 2026-10-15 04:19:24 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @jfoug on GitHub (Sep 18, 2016).
Original GitHub issue: https://github.com/openwall/john/issues/2278

As I have found out, ,doing a comprehensive check of gpg, the -cost items do not always go from quicker to slower. Here is a grid showing speeds with a mix of all cost2/cost3 values The vertical grid is hash type, and the horizontal is encryption type. Both are in order by 'cost' numbers, but as can be seen,

. idea 3des cast5 bf a128 a192 a256 2f c128 c192 c256
md5 52.1 24.6 49.4 40.8 51.5 25.5 25.4 21.8 53.3 25.7 25.6
sha1 41.6 20.7 41.7 33.2 40.2 20.8 20.5 19.9 40.7 20.8 20.7
ripmd 19.7 10.0 20.0 18.5 19.3 8.8 9.3 8.5 18.2 9.5 10.0
s256 20.7 19.8 20.8 18.3 20.9 20.2 20.7 19.8 20.4 18.4 20.5
s384 27.2 27.4 27.6 24.0 27.8 28.4 28.8 27.6 26.4 26.9 27.3
s512 27.5 28.5 28.7 24.5 27.6 27.8 28.4 27.3 28.5 27.1 26.5
s224 17.9 19.7 19.6 17.1 19.8 19.6 10.1 9.9 20.1 20.2 9.8

Is there anything we can (or should) do to help normalize how cost works ? I am sure there are other formats which the --cost values do not line up with throughput.

Originally created by @jfoug on GitHub (Sep 18, 2016). Original GitHub issue: https://github.com/openwall/john/issues/2278 As I have found out, ,doing a comprehensive check of gpg, the -cost items do not always go from quicker to slower. Here is a grid showing speeds with a mix of all cost2/cost3 values The vertical grid is hash type, and the horizontal is encryption type. Both are in order by 'cost' numbers, but as can be seen, | . | idea | 3des | cast5 | bf | a128 | a192 | a256 | 2f | c128 | c192 | c256 | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | md5 | 52.1 | 24.6 | 49.4 | 40.8 | 51.5 | 25.5 | 25.4 | 21.8 | 53.3 | 25.7 | 25.6 | | sha1 | 41.6 | 20.7 | 41.7 | 33.2 | 40.2 | 20.8 | 20.5 | 19.9 | 40.7 | 20.8 | 20.7 | | ripmd | 19.7 | 10.0 | 20.0 | 18.5 | 19.3 | 8.8 | 9.3 | 8.5 | 18.2 | 9.5 | 10.0 | | s256 | 20.7 | 19.8 | 20.8 | 18.3 | 20.9 | 20.2 | 20.7 | 19.8 | 20.4 | 18.4 | 20.5 | | s384 | 27.2 | 27.4 | 27.6 | 24.0 | 27.8 | 28.4 | 28.8 | 27.6 | 26.4 | 26.9 | 27.3 | | s512 | 27.5 | 28.5 | 28.7 | 24.5 | 27.6 | 27.8 | 28.4 | 27.3 | 28.5 | 27.1 | 26.5 | | s224 | 17.9 | 19.7 | 19.6 | 17.1 | 19.8 | 19.6 | 10.1 | 9.9 | 20.1 | 20.2 | 9.8 | Is there anything we can (or should) do to help normalize how cost works ? I am sure there are other formats which the --cost values do not line up with throughput.
Author
Owner

@frank-dittrich commented on GitHub (Sep 19, 2016):

I wouldn't to that for different algorithms.
The sequence might be different on another hardware.
And if later on a new algorithm gets added, I wouldn't want to change numbers, since this might have an impact on existing .rec files.
Also, if later tuning or a newly discovered shortcut changes the performance, you can't change those numbers.
For iteration counts, yes, this should be done.
Also, if an algorithm has several cost parameters, the one which has most impact on performance should be listed first. (But that might also depend on hardware.)

<!-- gh-comment-id:247912690 --> @frank-dittrich commented on GitHub (Sep 19, 2016): I wouldn't to that for different algorithms. The sequence might be different on another hardware. And if later on a new algorithm gets added, I wouldn't want to change numbers, since this might have an impact on existing .rec files. Also, if later tuning or a newly discovered shortcut changes the performance, you can't change those numbers. For iteration counts, yes, this should be done. Also, if an algorithm has several cost parameters, the one which has most impact on performance should be listed first. (But that might also depend on hardware.)
Author
Owner

@jfoug commented on GitHub (Sep 19, 2016):

This table is the number of hashes needed to produce the keys. So as can be seen, the largest variance in timings is due to width of the hash vs width of the required crypt key. There is also 'some' variance due to crypt type, but it is only seen in the faster hashes (md5, etc). As the hash type gets slower, it overtakes the loss of time for crypt. In crypt, the one that gives the strong 'impact' is blowfish, with it's nasty key setup. The other crypts really do not impact performance much. Now, once we get to faster keysetup (if we were to be able to move to SIMD), then the crypt overhead may play a much more important roll in overall throughput. But as can be seen with this table (in relation to the original table), the 1 limb vs 2 limb becomes very apparent.

. hashsz idea 3des cast5 bf a128 a192 a256 2f c128 c192 c256
keysz 16 24 16 16 16 24 32 32 16 24 32
md5 16 1 2 1 1 1 2 2 2 1 2 2
sha1 20 1 2 1 1 1 2 2 2 1 2 2
ripmd 20 1 2 1 1 1 2 2 2 1 2 2
s256 32 1 1 1 1 1 1 1 1 1 1 1
s384 48 1 1 1 1 1 1 1 1 1 1 1
s512 64 1 1 1 1 1 1 1 1 1 1 1
s224 28 1 1 1 1 1 1 2 2 1 1 2

Actually, this would be a better --cost than the crypt type. We could even have 3 cost values (to give bf a bit higher hit even though it is a 1 limb cost for all hash types).

<!-- gh-comment-id:248030740 --> @jfoug commented on GitHub (Sep 19, 2016): This table is the number of hashes needed to produce the keys. So as can be seen, the largest variance in timings is due to width of the hash vs width of the required crypt key. There is also 'some' variance due to crypt type, but it is only seen in the faster hashes (md5, etc). As the hash type gets slower, it overtakes the loss of time for crypt. In crypt, the one that gives the strong 'impact' is blowfish, with it's nasty key setup. The other crypts really do not impact performance much. Now, once we get to faster keysetup (if we were to be able to move to SIMD), then the crypt overhead may play a much more important roll in overall throughput. But as can be seen with this table (in relation to the original table), the 1 limb vs 2 limb becomes very apparent. | . | hashsz | idea | 3des | cast5 | bf | a128 | a192 | a256 | 2f | c128 | c192 | c256 | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | keysz | | 16 | 24 | 16 | 16 | 16 | 24 | 32 | 32 | 16 | 24 | 32 | | md5 | 16 | 1 | 2 | 1 | 1 | 1 | 2 | 2 | 2 | 1 | 2 | 2 | | sha1 | 20 | 1 | 2 | 1 | 1 | 1 | 2 | 2 | 2 | 1 | 2 | 2 | | ripmd | 20 | 1 | 2 | 1 | 1 | 1 | 2 | 2 | 2 | 1 | 2 | 2 | | s256 | 32 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | | s384 | 48 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | | s512 | 64 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | | s224 | 28 | 1 | 1 | 1 | 1 | 1 | 1 | 2 | 2 | 1 | 1 | 2 | Actually, this would be a better --cost than the crypt type. We could even have 3 cost values (to give bf a bit higher hit even though it is a 1 limb cost for all hash types).
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
openwall/john#1527
No description provided.