Tabnine Logo
Sha1CollisionException
Code IndexAdd Tabnine to your IDE (free)

How to use
Sha1CollisionException
in
org.eclipse.jgit.util.sha1

Best Java code snippets using org.eclipse.jgit.util.sha1.Sha1CollisionException (Showing top 2 results out of 315)

origin: org.eclipse.jgit/org.eclipse.jgit

private void finish() {
  int bufferLen = (int) (length & 63);
  if (bufferLen > 55) {
    // Last block is too small; pad, compress, pad another block.
    buffer[bufferLen++] = (byte) 0x80;
    Arrays.fill(buffer, bufferLen, 64, (byte) 0);
    compress(buffer, 0);
    Arrays.fill(buffer, 0, 56, (byte) 0);
  } else {
    // Last block can hold padding and length.
    buffer[bufferLen++] = (byte) 0x80;
    Arrays.fill(buffer, bufferLen, 56, (byte) 0);
  }
  // SHA-1 appends the length of the message in bits after the
  // padding block (above). Here length is in bytes. Multiply by
  // 8 by shifting by 3 as part of storing the 64 bit byte length
  // into the two words expected in the trailer.
  NB.encodeInt32(buffer, 56, (int) (length >>> (32 - 3)));
  NB.encodeInt32(buffer, 60, (int) (length << 3));
  compress(buffer, 0);
  if (foundCollision) {
    ObjectId id = h.toObjectId();
    LOG.warn("possible SHA-1 collision " + id.name()); //$NON-NLS-1$
    throw new Sha1CollisionException(id);
  }
}
origin: berlam/github-bucket

private void finish() {
  int bufferLen = (int) (length & 63);
  if (bufferLen > 55) {
    // Last block is too small; pad, compress, pad another block.
    buffer[bufferLen++] = (byte) 0x80;
    Arrays.fill(buffer, bufferLen, 64, (byte) 0);
    compress(buffer, 0);
    Arrays.fill(buffer, 0, 56, (byte) 0);
  } else {
    // Last block can hold padding and length.
    buffer[bufferLen++] = (byte) 0x80;
    Arrays.fill(buffer, bufferLen, 56, (byte) 0);
  }
  // SHA-1 appends the length of the message in bits after the
  // padding block (above). Here length is in bytes. Multiply by
  // 8 by shifting by 3 as part of storing the 64 bit byte length
  // into the two words expected in the trailer.
  NB.encodeInt32(buffer, 56, (int) (length >>> (32 - 3)));
  NB.encodeInt32(buffer, 60, (int) (length << 3));
  compress(buffer, 0);
  if (foundCollision) {
    ObjectId id = h.toObjectId();
    LOG.warn("possible SHA-1 collision " + id.name()); //$NON-NLS-1$
    throw new Sha1CollisionException(id);
  }
}
org.eclipse.jgit.util.sha1Sha1CollisionException

Javadoc

Thrown by org.eclipse.jgit.util.sha1.SHA1 if it detects a likely hash collision.

Most used methods

  • <init>
    Initialize with default message.

Popular in Java

  • Running tasks concurrently on multiple threads
  • setContentView (Activity)
  • getResourceAsStream (ClassLoader)
  • getExternalFilesDir (Context)
  • BufferedImage (java.awt.image)
    The BufferedImage subclass describes an java.awt.Image with an accessible buffer of image data. All
  • RandomAccessFile (java.io)
    Allows reading from and writing to a file in a random-access manner. This is different from the uni-
  • ExecutorService (java.util.concurrent)
    An Executor that provides methods to manage termination and methods that can produce a Future for tr
  • Handler (java.util.logging)
    A Handler object accepts a logging request and exports the desired messages to a target, for example
  • JPanel (javax.swing)
  • FileUtils (org.apache.commons.io)
    General file manipulation utilities. Facilities are provided in the following areas: * writing to a
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now