diff options
author | Shawn Pearce <spearce@spearce.org> | 2017-02-24 23:33:18 -0800 |
---|---|---|
committer | Shawn Pearce <spearce@spearce.org> | 2017-02-26 11:16:19 -0800 |
commit | 0f25f64d4882f7853c9d3dc84ec382d8a78ae646 (patch) | |
tree | 3a11faf0022edf6b30d9a8e37f4ca30b1c92acef /org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectId.java | |
parent | 982f5d1bf184a2edab726f3c77f09a1157059e35 (diff) | |
download | jgit-0f25f64d4882f7853c9d3dc84ec382d8a78ae646.tar.gz jgit-0f25f64d4882f7853c9d3dc84ec382d8a78ae646.zip |
Switch to pure Java SHA1 for ObjectId
Generate names for objects using only the pure Java SHA1
implementation, but continue using MessageDigest in tests.
This opens the possibility of changing the hashing function
to incorporate additional safety measures, such as those
used in sha1dc[1].
Since MessageDigest has higher throughput, continue using
MessageDigest for computing pack, idx and DirCache trailers.
These are less likely to be sensitive to SHAttered[2] types
of attacks, as Git uses them to detect random bit flips
during transfer, and not for content identity.
[1] https://github.com/cr-marcstevens/sha1collisiondetection
[2] https://shattered.it/
Change-Id: If6da98334201f7f20cb916e46f782c45f373784e
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectId.java')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectId.java | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectId.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectId.java index 2a2d67d25a..991f03f82e 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectId.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectId.java @@ -248,8 +248,17 @@ public class ObjectId extends AnyObjectId implements Serializable { } } - ObjectId(final int new_1, final int new_2, final int new_3, - final int new_4, final int new_5) { + /** + * Construct an ObjectId from 160 bits provided in 5 words. + * + * @param new_1 + * @param new_2 + * @param new_3 + * @param new_4 + * @param new_5 + * @since 4.7 + */ + public ObjectId(int new_1, int new_2, int new_3, int new_4, int new_5) { w1 = new_1; w2 = new_2; w3 = new_3; |