Jonathan Nieder
8 years ago
committed by
Gerrit Code Review @ Eclipse.org
11 changed files with 1929 additions and 93 deletions
Binary file not shown.
Binary file not shown.
@ -0,0 +1,92 @@
|
||||
/* Template for compress method; run through cpp. */ |
||||
|
||||
#define ROUND1_STEP(a, b, c, d, e, T) e += s1(a,b,c,d,w[T]); b = rotateLeft(b, 30) |
||||
#define ROUND2_STEP(a, b, c, d, e, T) e += s2(a,b,c,d,w[T]); b = rotateLeft(b, 30) |
||||
#define ROUND3_STEP(a, b, c, d, e, T) e += s3(a,b,c,d,w[T]); b = rotateLeft(b, 30) |
||||
#define ROUND4_STEP(a, b, c, d, e, T) e += s4(a,b,c,d,w[T]); b = rotateLeft(b, 30) |
||||
|
||||
ROUND1_STEP(a, b, c, d, e, 0); |
||||
ROUND1_STEP(e, a, b, c, d, 1); |
||||
ROUND1_STEP(d, e, a, b, c, 2); |
||||
ROUND1_STEP(c, d, e, a, b, 3); |
||||
ROUND1_STEP(b, c, d, e, a, 4); |
||||
ROUND1_STEP(a, b, c, d, e, 5); |
||||
ROUND1_STEP(e, a, b, c, d, 6); |
||||
ROUND1_STEP(d, e, a, b, c, 7); |
||||
ROUND1_STEP(c, d, e, a, b, 8); |
||||
ROUND1_STEP(b, c, d, e, a, 9); |
||||
ROUND1_STEP(a, b, c, d, e, 10); |
||||
ROUND1_STEP(e, a, b, c, d, 11); |
||||
ROUND1_STEP(d, e, a, b, c, 12); |
||||
ROUND1_STEP(c, d, e, a, b, 13); |
||||
ROUND1_STEP(b, c, d, e, a, 14); |
||||
ROUND1_STEP(a, b, c, d, e, 15); |
||||
ROUND1_STEP(e, a, b, c, d, 16); |
||||
ROUND1_STEP(d, e, a, b, c, 17); |
||||
ROUND1_STEP(c, d, e, a, b, 18); |
||||
ROUND1_STEP(b, c, d, e, a, 19); |
||||
|
||||
ROUND2_STEP(a, b, c, d, e, 20); |
||||
ROUND2_STEP(e, a, b, c, d, 21); |
||||
ROUND2_STEP(d, e, a, b, c, 22); |
||||
ROUND2_STEP(c, d, e, a, b, 23); |
||||
ROUND2_STEP(b, c, d, e, a, 24); |
||||
ROUND2_STEP(a, b, c, d, e, 25); |
||||
ROUND2_STEP(e, a, b, c, d, 26); |
||||
ROUND2_STEP(d, e, a, b, c, 27); |
||||
ROUND2_STEP(c, d, e, a, b, 28); |
||||
ROUND2_STEP(b, c, d, e, a, 29); |
||||
ROUND2_STEP(a, b, c, d, e, 30); |
||||
ROUND2_STEP(e, a, b, c, d, 31); |
||||
ROUND2_STEP(d, e, a, b, c, 32); |
||||
ROUND2_STEP(c, d, e, a, b, 33); |
||||
ROUND2_STEP(b, c, d, e, a, 34); |
||||
ROUND2_STEP(a, b, c, d, e, 35); |
||||
ROUND2_STEP(e, a, b, c, d, 36); |
||||
ROUND2_STEP(d, e, a, b, c, 37); |
||||
ROUND2_STEP(c, d, e, a, b, 38); |
||||
ROUND2_STEP(b, c, d, e, a, 39); |
||||
|
||||
ROUND3_STEP(a, b, c, d, e, 40); |
||||
ROUND3_STEP(e, a, b, c, d, 41); |
||||
ROUND3_STEP(d, e, a, b, c, 42); |
||||
ROUND3_STEP(c, d, e, a, b, 43); |
||||
ROUND3_STEP(b, c, d, e, a, 44); |
||||
ROUND3_STEP(a, b, c, d, e, 45); |
||||
ROUND3_STEP(e, a, b, c, d, 46); |
||||
ROUND3_STEP(d, e, a, b, c, 47); |
||||
ROUND3_STEP(c, d, e, a, b, 48); |
||||
ROUND3_STEP(b, c, d, e, a, 49); |
||||
ROUND3_STEP(a, b, c, d, e, 50); |
||||
ROUND3_STEP(e, a, b, c, d, 51); |
||||
ROUND3_STEP(d, e, a, b, c, 52); |
||||
ROUND3_STEP(c, d, e, a, b, 53); |
||||
ROUND3_STEP(b, c, d, e, a, 54); |
||||
ROUND3_STEP(a, b, c, d, e, 55); |
||||
ROUND3_STEP(e, a, b, c, d, 56); |
||||
ROUND3_STEP(d, e, a, b, c, 57); |
||||
state58.save(a, b, c, d, e); |
||||
ROUND3_STEP(c, d, e, a, b, 58); |
||||
ROUND3_STEP(b, c, d, e, a, 59); |
||||
|
||||
ROUND4_STEP(a, b, c, d, e, 60); |
||||
ROUND4_STEP(e, a, b, c, d, 61); |
||||
ROUND4_STEP(d, e, a, b, c, 62); |
||||
ROUND4_STEP(c, d, e, a, b, 63); |
||||
ROUND4_STEP(b, c, d, e, a, 64); |
||||
state65.save(a, b, c, d, e); |
||||
ROUND4_STEP(a, b, c, d, e, 65); |
||||
ROUND4_STEP(e, a, b, c, d, 66); |
||||
ROUND4_STEP(d, e, a, b, c, 67); |
||||
ROUND4_STEP(c, d, e, a, b, 68); |
||||
ROUND4_STEP(b, c, d, e, a, 69); |
||||
ROUND4_STEP(a, b, c, d, e, 70); |
||||
ROUND4_STEP(e, a, b, c, d, 71); |
||||
ROUND4_STEP(d, e, a, b, c, 72); |
||||
ROUND4_STEP(c, d, e, a, b, 73); |
||||
ROUND4_STEP(b, c, d, e, a, 74); |
||||
ROUND4_STEP(a, b, c, d, e, 75); |
||||
ROUND4_STEP(e, a, b, c, d, 76); |
||||
ROUND4_STEP(d, e, a, b, c, 77); |
||||
ROUND4_STEP(c, d, e, a, b, 78); |
||||
ROUND4_STEP(b, c, d, e, a, 79); |
@ -0,0 +1,192 @@
|
||||
/* Template for recompress method; run through cpp. */ |
||||
|
||||
#define ROUND1_STEP(a, b, c, d, e, T) {e += s1(a,b,c,d,w2[T]); b = rotateLeft(b, 30);} |
||||
#define ROUND2_STEP(a, b, c, d, e, T) {e += s2(a,b,c,d,w2[T]); b = rotateLeft(b, 30);} |
||||
#define ROUND3_STEP(a, b, c, d, e, T) {e += s3(a,b,c,d,w2[T]); b = rotateLeft(b, 30);} |
||||
#define ROUND4_STEP(a, b, c, d, e, T) {e += s4(a,b,c,d,w2[T]); b = rotateLeft(b, 30);} |
||||
|
||||
#define ROUND1_STEP_BW(a, b, c, d, e, T) {b = rotateRight(b, 30); e -= s1(a,b,c,d,w2[T]);} |
||||
#define ROUND2_STEP_BW(a, b, c, d, e, T) {b = rotateRight(b, 30); e -= s2(a,b,c,d,w2[T]);} |
||||
#define ROUND3_STEP_BW(a, b, c, d, e, T) {b = rotateRight(b, 30); e -= s3(a,b,c,d,w2[T]);} |
||||
#define ROUND4_STEP_BW(a, b, c, d, e, T) {b = rotateRight(b, 30); e -= s4(a,b,c,d,w2[T]);} |
||||
|
||||
/* Condition to go backwards: if (t > step) */ |
||||
/* t=80-66 have no identified DV; skip. |
||||
ROUND4_STEP_BW(b, c, d, e, a, 79) |
||||
ROUND4_STEP_BW(c, d, e, a, b, 78) |
||||
ROUND4_STEP_BW(d, e, a, b, c, 77) |
||||
ROUND4_STEP_BW(e, a, b, c, d, 76) |
||||
ROUND4_STEP_BW(a, b, c, d, e, 75) |
||||
ROUND4_STEP_BW(b, c, d, e, a, 74) |
||||
ROUND4_STEP_BW(c, d, e, a, b, 73) |
||||
ROUND4_STEP_BW(d, e, a, b, c, 72) |
||||
ROUND4_STEP_BW(e, a, b, c, d, 71) |
||||
ROUND4_STEP_BW(a, b, c, d, e, 70) |
||||
ROUND4_STEP_BW(b, c, d, e, a, 69) |
||||
ROUND4_STEP_BW(c, d, e, a, b, 68) |
||||
ROUND4_STEP_BW(d, e, a, b, c, 67) |
||||
ROUND4_STEP_BW(e, a, b, c, d, 66) |
||||
ROUND4_STEP_BW(a, b, c, d, e, 65) |
||||
*/ |
||||
if (t == 65) { |
||||
ROUND4_STEP_BW(b, c, d, e, a, 64) |
||||
ROUND4_STEP_BW(c, d, e, a, b, 63) |
||||
ROUND4_STEP_BW(d, e, a, b, c, 62) |
||||
ROUND4_STEP_BW(e, a, b, c, d, 61) |
||||
ROUND4_STEP_BW(a, b, c, d, e, 60) |
||||
|
||||
ROUND3_STEP_BW(b, c, d, e, a, 59) |
||||
ROUND3_STEP_BW(c, d, e, a, b, 58) |
||||
} |
||||
ROUND3_STEP_BW(d, e, a, b, c, 57) |
||||
ROUND3_STEP_BW(e, a, b, c, d, 56) |
||||
ROUND3_STEP_BW(a, b, c, d, e, 55) |
||||
ROUND3_STEP_BW(b, c, d, e, a, 54) |
||||
ROUND3_STEP_BW(c, d, e, a, b, 53) |
||||
ROUND3_STEP_BW(d, e, a, b, c, 52) |
||||
ROUND3_STEP_BW(e, a, b, c, d, 51) |
||||
ROUND3_STEP_BW(a, b, c, d, e, 50) |
||||
ROUND3_STEP_BW(b, c, d, e, a, 49) |
||||
ROUND3_STEP_BW(c, d, e, a, b, 48) |
||||
ROUND3_STEP_BW(d, e, a, b, c, 47) |
||||
ROUND3_STEP_BW(e, a, b, c, d, 46) |
||||
ROUND3_STEP_BW(a, b, c, d, e, 45) |
||||
ROUND3_STEP_BW(b, c, d, e, a, 44) |
||||
ROUND3_STEP_BW(c, d, e, a, b, 43) |
||||
ROUND3_STEP_BW(d, e, a, b, c, 42) |
||||
ROUND3_STEP_BW(e, a, b, c, d, 41) |
||||
ROUND3_STEP_BW(a, b, c, d, e, 40) |
||||
|
||||
ROUND2_STEP_BW(b, c, d, e, a, 39) |
||||
ROUND2_STEP_BW(c, d, e, a, b, 38) |
||||
ROUND2_STEP_BW(d, e, a, b, c, 37) |
||||
ROUND2_STEP_BW(e, a, b, c, d, 36) |
||||
ROUND2_STEP_BW(a, b, c, d, e, 35) |
||||
ROUND2_STEP_BW(b, c, d, e, a, 34) |
||||
ROUND2_STEP_BW(c, d, e, a, b, 33) |
||||
ROUND2_STEP_BW(d, e, a, b, c, 32) |
||||
ROUND2_STEP_BW(e, a, b, c, d, 31) |
||||
ROUND2_STEP_BW(a, b, c, d, e, 30) |
||||
ROUND2_STEP_BW(b, c, d, e, a, 29) |
||||
ROUND2_STEP_BW(c, d, e, a, b, 28) |
||||
ROUND2_STEP_BW(d, e, a, b, c, 27) |
||||
ROUND2_STEP_BW(e, a, b, c, d, 26) |
||||
ROUND2_STEP_BW(a, b, c, d, e, 25) |
||||
ROUND2_STEP_BW(b, c, d, e, a, 24) |
||||
ROUND2_STEP_BW(c, d, e, a, b, 23) |
||||
ROUND2_STEP_BW(d, e, a, b, c, 22) |
||||
ROUND2_STEP_BW(e, a, b, c, d, 21) |
||||
ROUND2_STEP_BW(a, b, c, d, e, 20) |
||||
|
||||
ROUND1_STEP_BW(b, c, d, e, a, 19) |
||||
ROUND1_STEP_BW(c, d, e, a, b, 18) |
||||
ROUND1_STEP_BW(d, e, a, b, c, 17) |
||||
ROUND1_STEP_BW(e, a, b, c, d, 16) |
||||
ROUND1_STEP_BW(a, b, c, d, e, 15) |
||||
ROUND1_STEP_BW(b, c, d, e, a, 14) |
||||
ROUND1_STEP_BW(c, d, e, a, b, 13) |
||||
ROUND1_STEP_BW(d, e, a, b, c, 12) |
||||
ROUND1_STEP_BW(e, a, b, c, d, 11) |
||||
ROUND1_STEP_BW(a, b, c, d, e, 10) |
||||
ROUND1_STEP_BW(b, c, d, e, a, 9) |
||||
ROUND1_STEP_BW(c, d, e, a, b, 8) |
||||
ROUND1_STEP_BW(d, e, a, b, c, 7) |
||||
ROUND1_STEP_BW(e, a, b, c, d, 6) |
||||
ROUND1_STEP_BW(a, b, c, d, e, 5) |
||||
ROUND1_STEP_BW(b, c, d, e, a, 4) |
||||
ROUND1_STEP_BW(c, d, e, a, b, 3) |
||||
ROUND1_STEP_BW(d, e, a, b, c, 2) |
||||
ROUND1_STEP_BW(e, a, b, c, d, 1) |
||||
ROUND1_STEP_BW(a, b, c, d, e, 0) |
||||
|
||||
hIn.save(a, b, c, d, e); |
||||
a = s.a; b = s.b; c = s.c; d = s.d; e = s.e; |
||||
|
||||
/* Condition to go fowards: if (t <= step) */ |
||||
/* Earliest restart is T=58; skip. |
||||
ROUND1_STEP(a, b, c, d, e, 0) |
||||
ROUND1_STEP(e, a, b, c, d, 1) |
||||
ROUND1_STEP(d, e, a, b, c, 2) |
||||
ROUND1_STEP(c, d, e, a, b, 3) |
||||
ROUND1_STEP(b, c, d, e, a, 4) |
||||
ROUND1_STEP(a, b, c, d, e, 5) |
||||
ROUND1_STEP(e, a, b, c, d, 6) |
||||
ROUND1_STEP(d, e, a, b, c, 7) |
||||
ROUND1_STEP(c, d, e, a, b, 8) |
||||
ROUND1_STEP(b, c, d, e, a, 9) |
||||
ROUND1_STEP(a, b, c, d, e, 10) |
||||
ROUND1_STEP(e, a, b, c, d, 11) |
||||
ROUND1_STEP(d, e, a, b, c, 12) |
||||
ROUND1_STEP(c, d, e, a, b, 13) |
||||
ROUND1_STEP(b, c, d, e, a, 14) |
||||
ROUND1_STEP(a, b, c, d, e, 15) |
||||
ROUND1_STEP(e, a, b, c, d, 16) |
||||
ROUND1_STEP(d, e, a, b, c, 17) |
||||
ROUND1_STEP(c, d, e, a, b, 18) |
||||
ROUND1_STEP(b, c, d, e, a, 19) |
||||
|
||||
ROUND2_STEP(a, b, c, d, e, 20) |
||||
ROUND2_STEP(e, a, b, c, d, 21) |
||||
ROUND2_STEP(d, e, a, b, c, 22) |
||||
ROUND2_STEP(c, d, e, a, b, 23) |
||||
ROUND2_STEP(b, c, d, e, a, 24) |
||||
ROUND2_STEP(a, b, c, d, e, 25) |
||||
ROUND2_STEP(e, a, b, c, d, 26) |
||||
ROUND2_STEP(d, e, a, b, c, 27) |
||||
ROUND2_STEP(c, d, e, a, b, 28) |
||||
ROUND2_STEP(b, c, d, e, a, 29) |
||||
ROUND2_STEP(a, b, c, d, e, 30) |
||||
ROUND2_STEP(e, a, b, c, d, 31) |
||||
ROUND2_STEP(d, e, a, b, c, 32) |
||||
ROUND2_STEP(c, d, e, a, b, 33) |
||||
ROUND2_STEP(b, c, d, e, a, 34) |
||||
ROUND2_STEP(a, b, c, d, e, 35) |
||||
ROUND2_STEP(e, a, b, c, d, 36) |
||||
ROUND2_STEP(d, e, a, b, c, 37) |
||||
ROUND2_STEP(c, d, e, a, b, 38) |
||||
ROUND2_STEP(b, c, d, e, a, 39) |
||||
|
||||
ROUND3_STEP(a, b, c, d, e, 40) |
||||
ROUND3_STEP(e, a, b, c, d, 41) |
||||
ROUND3_STEP(d, e, a, b, c, 42) |
||||
ROUND3_STEP(c, d, e, a, b, 43) |
||||
ROUND3_STEP(b, c, d, e, a, 44) |
||||
ROUND3_STEP(a, b, c, d, e, 45) |
||||
ROUND3_STEP(e, a, b, c, d, 46) |
||||
ROUND3_STEP(d, e, a, b, c, 47) |
||||
ROUND3_STEP(c, d, e, a, b, 48) |
||||
ROUND3_STEP(b, c, d, e, a, 49) |
||||
ROUND3_STEP(a, b, c, d, e, 50) |
||||
ROUND3_STEP(e, a, b, c, d, 51) |
||||
ROUND3_STEP(d, e, a, b, c, 52) |
||||
ROUND3_STEP(c, d, e, a, b, 53) |
||||
ROUND3_STEP(b, c, d, e, a, 54) |
||||
ROUND3_STEP(a, b, c, d, e, 55) |
||||
ROUND3_STEP(e, a, b, c, d, 56) |
||||
ROUND3_STEP(d, e, a, b, c, 57) |
||||
*/ |
||||
if (t == 58) { |
||||
ROUND3_STEP(c, d, e, a, b, 58) |
||||
ROUND3_STEP(b, c, d, e, a, 59) |
||||
|
||||
ROUND4_STEP(a, b, c, d, e, 60) |
||||
ROUND4_STEP(e, a, b, c, d, 61) |
||||
ROUND4_STEP(d, e, a, b, c, 62) |
||||
ROUND4_STEP(c, d, e, a, b, 63) |
||||
ROUND4_STEP(b, c, d, e, a, 64) |
||||
} |
||||
ROUND4_STEP(a, b, c, d, e, 65) |
||||
ROUND4_STEP(e, a, b, c, d, 66) |
||||
ROUND4_STEP(d, e, a, b, c, 67) |
||||
ROUND4_STEP(c, d, e, a, b, 68) |
||||
ROUND4_STEP(b, c, d, e, a, 69) |
||||
ROUND4_STEP(a, b, c, d, e, 70) |
||||
ROUND4_STEP(e, a, b, c, d, 71) |
||||
ROUND4_STEP(d, e, a, b, c, 72) |
||||
ROUND4_STEP(c, d, e, a, b, 73) |
||||
ROUND4_STEP(b, c, d, e, a, 74) |
||||
ROUND4_STEP(a, b, c, d, e, 75) |
||||
ROUND4_STEP(e, a, b, c, d, 76) |
||||
ROUND4_STEP(d, e, a, b, c, 77) |
||||
ROUND4_STEP(c, d, e, a, b, 78) |
||||
ROUND4_STEP(b, c, d, e, a, 79) |
@ -0,0 +1,70 @@
|
||||
/* |
||||
* Copyright (C) 2017, Google Inc. |
||||
* and other copyright owners as documented in the project's IP log. |
||||
* |
||||
* This program and the accompanying materials are made available |
||||
* under the terms of the Eclipse Distribution License v1.0 which |
||||
* accompanies this distribution, is reproduced below, and is |
||||
* available at http://www.eclipse.org/org/documents/edl-v10.php
|
||||
* |
||||
* All rights reserved. |
||||
* |
||||
* Redistribution and use in source and binary forms, with or |
||||
* without modification, are permitted provided that the following |
||||
* conditions are met: |
||||
* |
||||
* - Redistributions of source code must retain the above copyright |
||||
* notice, this list of conditions and the following disclaimer. |
||||
* |
||||
* - Redistributions in binary form must reproduce the above |
||||
* copyright notice, this list of conditions and the following |
||||
* disclaimer in the documentation and/or other materials provided |
||||
* with the distribution. |
||||
* |
||||
* - Neither the name of the Eclipse Foundation, Inc. nor the |
||||
* names of its contributors may be used to endorse or promote |
||||
* products derived from this software without specific prior |
||||
* written permission. |
||||
* |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND |
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, |
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||
*/ |
||||
|
||||
package org.eclipse.jgit.util.sha1; |
||||
|
||||
import java.text.MessageFormat; |
||||
|
||||
import org.eclipse.jgit.internal.JGitText; |
||||
import org.eclipse.jgit.lib.ObjectId; |
||||
|
||||
/** |
||||
* Thrown by {@link SHA1} if it detects a likely hash collision. |
||||
* |
||||
* @since 4.7 |
||||
*/ |
||||
public class Sha1CollisionException extends RuntimeException { |
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
/** |
||||
* Initialize with default message. |
||||
* |
||||
* @param id |
||||
* object whose contents are a hash collision. |
||||
*/ |
||||
public Sha1CollisionException(ObjectId id) { |
||||
super(MessageFormat.format( |
||||
JGitText.get().sha1CollisionDetected1, |
||||
id.name())); |
||||
} |
||||
} |
Loading…
Reference in new issue