| Modifier and Type | Class and Description |
|---|---|
static class |
SHA1.Sha1Implementation
SHA1 implementations available in JGit
|
| Constructor and Description |
|---|
SHA1() |
| Modifier and Type | Method and Description |
|---|---|
abstract byte[] |
digest()
Finish the digest and return the resulting hash.
|
abstract void |
digest(MutableObjectId id)
Finish the digest and return the resulting hash.
|
abstract boolean |
hasCollision()
Check if a collision was detected.
|
static SHA1 |
newInstance()
Create a new context to compute a SHA-1 hash of data.
|
abstract SHA1 |
reset()
Reset this instance to compute another hash.
|
abstract SHA1 |
setDetectCollision(boolean detect)
Enable likely collision detection.
|
abstract ObjectId |
toObjectId()
Finish the digest and return the resulting hash.
|
abstract void |
update(byte b)
Update the digest computation by adding a byte.
|
abstract void |
update(byte[] in)
Update the digest computation by adding bytes to the message.
|
abstract void |
update(byte[] in,
int p,
int len)
Update the digest computation by adding bytes to the message.
|
public static SHA1 newInstance()
If core.sha1Implementation = jdkNative in the user level global
git configuration or the system property
org.eclipse.jgit.util.sha1.implementation = jdkNative it will
create an object using the implementation in the JDK. If both are set the
system property takes precedence. Otherwise the pure Java implementation
will be used which supports collision detection but is slower.
public abstract void update(byte b)
b - a byte.public abstract void update(byte[] in)
in - input array of bytes.public abstract void update(byte[] in,
int p,
int len)
in - input array of bytes.p - offset to start at from in.len - number of bytes to hash.public abstract byte[] digest()
throws Sha1CollisionException
Once digest() is called, this instance should be discarded.
Sha1CollisionException - if a collision was detected and safeHash is false.public abstract ObjectId toObjectId() throws Sha1CollisionException
Once digest() is called, this instance should be discarded.
Sha1CollisionException - if a collision was detected and safeHash is false.public abstract void digest(MutableObjectId id) throws Sha1CollisionException
Once digest() is called, this instance should be discarded.
id - destination to copy the digest to.Sha1CollisionException - if a collision was detected and safeHash is false.public abstract SHA1 reset()
this.public abstract SHA1 setDetectCollision(boolean detect)
Default for implementations supporting collision detection is
true.
Implementations not supporting collision detection ignore calls to this method.
detect - a boolean.thispublic abstract boolean hasCollision()
digest(),
digest(MutableObjectId) or toObjectId(), as the hashing
function must finish processing to know the final state.
Implementations not supporting collision detection always return
false.
true if a likely collision was detected.Copyright © 2023 Eclipse JGit Project. All rights reserved.