code: public static int correctDCH( int N , int messageNoMask , int generator , int totalBits, int dataBits) {
  		int bestHamming = 255;
  		int bestMessage = -1;
  
  		int errorBits = totalBits-dataBits;
  
  		// exhaustively check all possibilities
  		for (int i = 0; i < N; i++) {
  			int test = i << errorBits;
  			test = test ^ bitPolyModulus(test,generator,totalBits,dataBits);
  
  			int distance = DescriptorDistance.hamming(test^messageNoMask);
  
  			// see if it found a better match
  			if( distance < bestHamming ) {
  				bestHamming = distance;
  				bestMessage = i;
  			} else if( distance == bestHamming ) {
  				// ambiguous so reject
  				bestMessage = -1;
  			}
  		}
  		return bestMessage;
  	}
docs: Applies a brute force algorithm to find the message which has the smallest hamming distance. if two
  messages have the same distance -1 is returned.
  @param N Number of possible messages. 32 or 64
  @param messageNoMask The observed message with mask removed
  @param generator Generator polynomial
  @param totalBits Total number of bits in the message.
  @param dataBits Total number of data bits in the message
  @return The error corrected message or -1 if it can't be determined.