1 17 package org.alfresco.repo.security.authentication.ntlm; 18 19 import org.alfresco.filesys.util.HexDump; 20 21 26 public class NTLMChallenge 27 { 28 30 private byte[] m_challenge; 31 32 37 protected NTLMChallenge(byte[] chbyts) 38 { 39 m_challenge = chbyts; 40 } 41 42 47 public final byte[] getBytes() 48 { 49 return m_challenge; 50 } 51 52 58 public boolean equals(Object obj) 59 { 60 if ( obj instanceof NTLMChallenge) 61 { 62 NTLMChallenge ntlmCh = (NTLMChallenge) obj; 63 64 66 if ( getBytes() == null && ntlmCh.getBytes() == null) 67 return true; 68 69 71 if ( getBytes() != null && ntlmCh.getBytes() != null && 72 getBytes().length == ntlmCh.getBytes().length) 73 { 74 76 byte[] ntlmBytes = ntlmCh.getBytes(); 77 78 for ( int i = 0; i < m_challenge.length; i++) 79 if ( m_challenge[i] != ntlmBytes[i]) 80 return false; 81 } 82 else 83 return false; 84 } 85 86 88 return false; 89 } 90 91 96 public String toString() 97 { 98 StringBuilder str = new StringBuilder (); 99 100 str.append("["); 101 str.append(HexDump.hexString(getBytes(), " ")); 102 str.append("]"); 103 104 return str.toString(); 105 } 106 } 107 | Popular Tags |