/** * Finish the digest and return the resulting hash. * <p> * Once {@code digest()} is called, this instance should be discarded. * * @return the ObjectId for the resulting hash. * @throws org.eclipse.jgit.util.sha1.Sha1CollisionException * if a collision was detected and safeHash is false. */ public ObjectId toObjectId() throws Sha1CollisionException { finish(); return h.toObjectId(); }
/** * Finish the digest and return the resulting hash. * <p> * Once {@code digest()} is called, this instance should be discarded. * * @param id * destination to copy the digest to. * @throws org.eclipse.jgit.util.sha1.Sha1CollisionException * if a collision was detected and safeHash is false. */ public void digest(MutableObjectId id) throws Sha1CollisionException { finish(); id.set(h.a, h.b, h.c, h.d, h.e); }
/** * Finish the digest and return the resulting hash. * <p> * Once {@code digest()} is called, this instance should be discarded. * * @return the bytes for the resulting hash. * @throws org.eclipse.jgit.util.sha1.Sha1CollisionException * if a collision was detected and safeHash is false. */ public byte[] digest() throws Sha1CollisionException { finish(); byte[] b = new byte[20]; NB.encodeInt32(b, 0, h.a); NB.encodeInt32(b, 4, h.b); NB.encodeInt32(b, 8, h.c); NB.encodeInt32(b, 12, h.d); NB.encodeInt32(b, 16, h.e); return b; }
/** * Finish the digest and return the resulting hash. * <p> * Once {@code digest()} is called, this instance should be discarded. * * @return the ObjectId for the resulting hash. * @throws org.eclipse.jgit.util.sha1.Sha1CollisionException * if a collision was detected and safeHash is false. */ public ObjectId toObjectId() throws Sha1CollisionException { finish(); return h.toObjectId(); }
/** * Finish the digest and return the resulting hash. * <p> * Once {@code digest()} is called, this instance should be discarded. * * @param id * destination to copy the digest to. * @throws org.eclipse.jgit.util.sha1.Sha1CollisionException * if a collision was detected and safeHash is false. */ public void digest(MutableObjectId id) throws Sha1CollisionException { finish(); id.set(h.a, h.b, h.c, h.d, h.e); }
/** * Finish the digest and return the resulting hash. * <p> * Once {@code digest()} is called, this instance should be discarded. * * @return the bytes for the resulting hash. * @throws org.eclipse.jgit.util.sha1.Sha1CollisionException * if a collision was detected and safeHash is false. */ public byte[] digest() throws Sha1CollisionException { finish(); byte[] b = new byte[20]; NB.encodeInt32(b, 0, h.a); NB.encodeInt32(b, 4, h.b); NB.encodeInt32(b, 8, h.c); NB.encodeInt32(b, 12, h.d); NB.encodeInt32(b, 16, h.e); return b; }