@@ -33,16 +33,9 @@ researchers. On 23 February 2017 the SHAttered attack
33
33
34
34
Git v2.13.0 and later subsequently moved to a hardened SHA-1
35
35
implementation by default, which isn't vulnerable to the SHAttered
36
- attack.
36
+ attack, but SHA-1 is still weak .
37
37
38
- Thus Git has in effect already migrated to a new hash that isn't SHA-1
39
- and doesn't share its vulnerabilities, its new hash function just
40
- happens to produce exactly the same output for all known inputs,
41
- except two PDFs published by the SHAttered researchers, and the new
42
- implementation (written by those researchers) claims to detect future
43
- cryptanalytic collision attacks.
44
-
45
- Regardless, it's considered prudent to move past any variant of SHA-1
38
+ Thus it's considered prudent to move past any variant of SHA-1
46
39
to a new hash. There's no guarantee that future attacks on SHA-1 won't
47
40
be published in the future, and those attacks may not have viable
48
41
mitigations.
@@ -57,6 +50,38 @@ SHA-1 still possesses the other properties such as fast object lookup
57
50
and safe error checking, but other hash functions are equally suitable
58
51
that are believed to be cryptographically secure.
59
52
53
+ Choice of Hash
54
+ --------------
55
+ The hash to replace the hardened SHA-1 should be stronger than SHA-1
56
+ was: we would like it to be trustworthy and useful in practice for at
57
+ least 10 years.
58
+
59
+ Some other relevant properties:
60
+
61
+ 1. A 256-bit hash (long enough to match common security practice; not
62
+ excessively long to hurt performance and disk usage).
63
+
64
+ 2. High quality implementations should be widely available (e.g., in
65
+ OpenSSL and Apple CommonCrypto).
66
+
67
+ 3. The hash function's properties should match Git's needs (e.g. Git
68
+ requires collision and 2nd preimage resistance and does not require
69
+ length extension resistance).
70
+
71
+ 4. As a tiebreaker, the hash should be fast to compute (fortunately
72
+ many contenders are faster than SHA-1).
73
+
74
+ There were several contenders for a successor hash to SHA-1, including
75
+ SHA-256, SHA-512/256, SHA-256x16, K12, and BLAKE2bp-256.
76
+
77
+ In late 2018 the project picked SHA-256 as its successor hash.
78
+
79
+ See 0ed8d8da374 (doc hash-function-transition: pick SHA-256 as
80
+ NewHash, 2018-08-04) and numerous mailing list threads at the time,
81
+ particularly the one starting at
82
+ https://lore.kernel.org/git/
[email protected] /
83
+ for more information.
84
+
60
85
Goals
61
86
-----
62
87
1. The transition to SHA-256 can be done one local repository at a time.
@@ -601,39 +626,6 @@ example:
601
626
602
627
git --output-format=sha1 log abac87a^{sha1}..f787cac^{sha256}
603
628
604
- Choice of Hash
605
- --------------
606
- In early 2005, around the time that Git was written, Xiaoyun Wang,
607
- Yiqun Lisa Yin, and Hongbo Yu announced an attack finding SHA-1
608
- collisions in 2^69 operations. In August they published details.
609
- Luckily, no practical demonstrations of a collision in full SHA-1 were
610
- published until 10 years later, in 2017.
611
-
612
- Git v2.13.0 and later subsequently moved to a hardened SHA-1
613
- implementation by default that mitigates the SHAttered attack, but
614
- SHA-1 is still believed to be weak.
615
-
616
- The hash to replace this hardened SHA-1 should be stronger than SHA-1
617
- was: we would like it to be trustworthy and useful in practice for at
618
- least 10 years.
619
-
620
- Some other relevant properties:
621
-
622
- 1. A 256-bit hash (long enough to match common security practice; not
623
- excessively long to hurt performance and disk usage).
624
-
625
- 2. High quality implementations should be widely available (e.g., in
626
- OpenSSL and Apple CommonCrypto).
627
-
628
- 3. The hash function's properties should match Git's needs (e.g. Git
629
- requires collision and 2nd preimage resistance and does not require
630
- length extension resistance).
631
-
632
- 4. As a tiebreaker, the hash should be fast to compute (fortunately
633
- many contenders are faster than SHA-1).
634
-
635
- We choose SHA-256.
636
-
637
629
Transition plan
638
630
---------------
639
631
Some initial steps can be implemented independently of one another:
0 commit comments