CollisionDJBX implements CollisionInterface { public int hashBack( String s, int target ) { byte[] byteArray = s.getBytes( Charset.defaultCharset() ); int n = byteArray.length; int hash = target; for ( int i = n; i > 0; i-- ) { hash = ( ( hash - byteArray[i - 1] ) * -1904545857 ); } return hash; }  int getLengthString(); void setLengthString( int lengthString ); int getLengthSuffix(); void setLengthSuffix( int lengthSuffix ); @Override int getHash( String s ); int hashForth( String s ); int hashBack( String s, int target ); @Override void genNCollisions( int numberAttributes, StringBuilder sb, boolean useNamespace ); @Override String getCollisionString( int i, int n ); Set<String> generateCollionsMeetInTheMiddle( long numberCollisions ); String getIthNCharString( int i, int n );  }
@Test public void hashBackTest() { assertThat( collisionDJBX.hashBack( "0", 7 ), is( 776968809 ) ); assertThat( collisionDJBX.hashBack( "abc", 7 ), is( 118185115 ) ); }