package waffle.util;

import java.util.Arrays;

/**
 * Rudimentary NTLM message utility.
 * @author dblock[at]dblock[dot]org
 */
public abstract class NtlmMessage {
	
	// NTLM messages start with 0x4e544c4d53535000, NTLMSSP signature
	static final byte[] ntlmsspSignature = { 0x4e, 0x54, 0x4c, 0x4d, 0x53, 0x53, 0x50, 0x00 };

	public static boolean isNtlmMessage(byte[] message) {	
		if (message == null || message.length < ntlmsspSignature.length)
			return false;
		
		byte[] messageSignature = Arrays.copyOfRange(message, 0, ntlmsspSignature.length);
		return Arrays.equals(ntlmsspSignature, messageSignature);
	}
	
	/**
	 * Get NTLM message type.
	 * @param message
	 *  Assuming a valid NTLM message.
	 * @return
	 *  Message type.  
	 */
	public static int getMessageType(byte[] message) {
		return message[ntlmsspSignature.length];
	}
}

@@ -21,34 +21,8 @@
 %0D%0A%0D%0A
-import java.util.Arrays;%0D%0A
 %0D%0A/*
@@ -460,114 +460,66 @@
 %0D%0A%09%09
-byte%5B%5D messageSignature = Arrays.copyOfRange(message, 0, ntlmsspSignature.length);%0D%0A%09%09return Arrays.equals
+for(int i = 0; i %3C ntlmsspSignature.length; i++) %7B%0D%0A%09%09%09if 
 (ntl
@@ -535,17 +535,22 @@
 ture
-,
+%5Bi%5D !=
  message
 Sign
@@ -549,18 +549,55 @@
 sage
-Signature)
+%5Bi%5D)%0D%0A%09%09%09%09return false;%0D%0A%09%09%7D%0D%0A%09%09%0D%0A%09%09return true
 ;%0D%0A%09

Downgrade Java class version to 1.5 http://waffle.codeplex.com/workitem/8754