/** * Generate the ANSI DES hash for the password associated with these credentials. */ static public byte[] getPreNTLMResponse( String password, byte[] challenge ) { byte[] p14 = new byte[14]; byte[] p21 = new byte[21]; byte[] p24 = new byte[24]; byte[] passwordBytes; try { passwordBytes = password.toUpperCase().getBytes( ServerMessageBlock.OEM_ENCODING ); } catch( UnsupportedEncodingException uee ) { throw new RuntimeException("Try setting jcifs.encoding=US-ASCII", uee); } int passwordLength = passwordBytes.length; // Only encrypt the first 14 bytes of the password for Pre 0.12 NT LM if( passwordLength > 14) { passwordLength = 14; } System.arraycopy( passwordBytes, 0, p14, 0, passwordLength ); E( p14, S8, p21); E( p21, challenge, p24); return p24; } /**
/** * Generate the ANSI DES hash for the password associated with these credentials. */ static public byte[] getPreNTLMResponse( String password, byte[] challenge ) { byte[] p14 = new byte[14]; byte[] p21 = new byte[21]; byte[] p24 = new byte[24]; byte[] passwordBytes; try { passwordBytes = password.toUpperCase().getBytes( ServerMessageBlock.OEM_ENCODING ); } catch( UnsupportedEncodingException uee ) { throw new RuntimeException("Try setting jcifs.encoding=US-ASCII", uee); } int passwordLength = passwordBytes.length; // Only encrypt the first 14 bytes of the password for Pre 0.12 NT LM if( passwordLength > 14) { passwordLength = 14; } System.arraycopy( passwordBytes, 0, p14, 0, passwordLength ); E( p14, S8, p21); E( p21, challenge, p24); return p24; } /**
/** * Generate the ANSI DES hash for the password associated with these credentials. */ static public byte[] getPreNTLMResponse( String password, byte[] challenge ) { byte[] p14 = new byte[14]; byte[] p21 = new byte[21]; byte[] p24 = new byte[24]; byte[] passwordBytes; try { passwordBytes = password.toUpperCase().getBytes( ServerMessageBlock.OEM_ENCODING ); } catch( UnsupportedEncodingException uee ) { throw new RuntimeException("Try setting jcifs.encoding=US-ASCII", uee); } int passwordLength = passwordBytes.length; // Only encrypt the first 14 bytes of the password for Pre 0.12 NT LM if( passwordLength > 14) { passwordLength = 14; } System.arraycopy( passwordBytes, 0, p14, 0, passwordLength ); E( p14, S8, p21); E( p21, challenge, p24); return p24; } /**
/** * Generate the ANSI DES hash for the password associated with these credentials. */ static public byte[] getPreNTLMResponse( String password, byte[] challenge ) { byte[] p14 = new byte[14]; byte[] p21 = new byte[21]; byte[] p24 = new byte[24]; byte[] passwordBytes; try { passwordBytes = password.toUpperCase().getBytes( ServerMessageBlock.OEM_ENCODING ); } catch( UnsupportedEncodingException uee ) { throw new RuntimeException("Try setting jcifs.encoding=US-ASCII", uee); } int passwordLength = passwordBytes.length; // Only encrypt the first 14 bytes of the password for Pre 0.12 NT LM if( passwordLength > 14) { passwordLength = 14; } System.arraycopy( passwordBytes, 0, p14, 0, passwordLength ); E( p14, S8, p21); E( p21, challenge, p24); return p24; } /**
public static byte[] getNTLM2Response(byte[] nTOWFv1, byte[] serverChallenge, byte[] clientChallenge) { byte[] sessionHash = new byte[8]; try { MessageDigest md5; md5 = MessageDigest.getInstance("MD5"); md5.update(serverChallenge); md5.update(clientChallenge, 0, 8); System.arraycopy(md5.digest(), 0, sessionHash, 0, 8); } catch (GeneralSecurityException gse) { if (log.level > 0) gse.printStackTrace(log); throw new RuntimeException("MD5", gse); } byte[] key = new byte[21]; System.arraycopy(nTOWFv1, 0, key, 0, 16); byte[] ntResponse = new byte[24]; E(key, sessionHash, ntResponse); return ntResponse; } public static byte[] nTOWFv1(String password)
public static byte[] getNTLM2Response(byte[] nTOWFv1, byte[] serverChallenge, byte[] clientChallenge) { byte[] sessionHash = new byte[8]; try { MessageDigest md5; md5 = MessageDigest.getInstance("MD5"); md5.update(serverChallenge); md5.update(clientChallenge, 0, 8); System.arraycopy(md5.digest(), 0, sessionHash, 0, 8); } catch (GeneralSecurityException gse) { if (log.level > 0) gse.printStackTrace(log); throw new RuntimeException("MD5", gse); } byte[] key = new byte[21]; System.arraycopy(nTOWFv1, 0, key, 0, 16); byte[] ntResponse = new byte[24]; E(key, sessionHash, ntResponse); return ntResponse; } public static byte[] nTOWFv1(String password)
public static byte[] getNTLM2Response(byte[] nTOWFv1, byte[] serverChallenge, byte[] clientChallenge) { byte[] sessionHash = new byte[8]; try { MessageDigest md5; md5 = MessageDigest.getInstance("MD5"); md5.update(serverChallenge); md5.update(clientChallenge, 0, 8); System.arraycopy(md5.digest(), 0, sessionHash, 0, 8); } catch (GeneralSecurityException gse) { if (log.level > 0) gse.printStackTrace(log); throw new RuntimeException("MD5", gse); } byte[] key = new byte[21]; System.arraycopy(nTOWFv1, 0, key, 0, 16); byte[] ntResponse = new byte[24]; E(key, sessionHash, ntResponse); return ntResponse; } public static byte[] nTOWFv1(String password)
public static byte[] getNTLM2Response(byte[] nTOWFv1, byte[] serverChallenge, byte[] clientChallenge) { byte[] sessionHash = new byte[8]; try { MessageDigest md5; md5 = MessageDigest.getInstance("MD5"); md5.update(serverChallenge); md5.update(clientChallenge, 0, 8); System.arraycopy(md5.digest(), 0, sessionHash, 0, 8); } catch (GeneralSecurityException gse) { if (log.level > 0) gse.printStackTrace(log); throw new RuntimeException("MD5", gse); } byte[] key = new byte[21]; System.arraycopy(nTOWFv1, 0, key, 0, 16); byte[] ntResponse = new byte[24]; E(key, sessionHash, ntResponse); return ntResponse; } public static byte[] nTOWFv1(String password)
/** * Generate the Unicode MD4 hash for the password associated with these credentials. */ static public byte[] getNTLMResponse( String password, byte[] challenge ) { byte[] uni = null; byte[] p21 = new byte[21]; byte[] p24 = new byte[24]; try { uni = password.getBytes( SmbConstants.UNI_ENCODING ); } catch( UnsupportedEncodingException uee ) { if( log.level > 0 ) uee.printStackTrace( log ); } MD4 md4 = new MD4(); md4.update( uni ); try { md4.digest(p21, 0, 16); } catch (Exception ex) { if( log.level > 0 ) ex.printStackTrace( log ); } E( p21, challenge, p24 ); return p24; }
/** * Generate the Unicode MD4 hash for the password associated with these credentials. */ static public byte[] getNTLMResponse( String password, byte[] challenge ) { byte[] uni = null; byte[] p21 = new byte[21]; byte[] p24 = new byte[24]; try { uni = password.getBytes( SmbConstants.UNI_ENCODING ); } catch( UnsupportedEncodingException uee ) { if( log.level > 0 ) uee.printStackTrace( log ); } MD4 md4 = new MD4(); md4.update( uni ); try { md4.digest(p21, 0, 16); } catch (Exception ex) { if( log.level > 0 ) ex.printStackTrace( log ); } E( p21, challenge, p24 ); return p24; }
/** * Generate the Unicode MD4 hash for the password associated with these credentials. */ static public byte[] getNTLMResponse( String password, byte[] challenge ) { byte[] uni = null; byte[] p21 = new byte[21]; byte[] p24 = new byte[24]; try { uni = password.getBytes( SmbConstants.UNI_ENCODING ); } catch( UnsupportedEncodingException uee ) { if( log.level > 0 ) uee.printStackTrace( log ); } MD4 md4 = new MD4(); md4.update( uni ); try { md4.digest(p21, 0, 16); } catch (Exception ex) { if( log.level > 0 ) ex.printStackTrace( log ); } E( p21, challenge, p24 ); return p24; }
/** * Generate the Unicode MD4 hash for the password associated with these credentials. */ static public byte[] getNTLMResponse( String password, byte[] challenge ) { byte[] uni = null; byte[] p21 = new byte[21]; byte[] p24 = new byte[24]; try { uni = password.getBytes( SmbConstants.UNI_ENCODING ); } catch( UnsupportedEncodingException uee ) { if( log.level > 0 ) uee.printStackTrace( log ); } MD4 md4 = new MD4(); md4.update( uni ); try { md4.digest(p21, 0, 16); } catch (Exception ex) { if( log.level > 0 ) ex.printStackTrace( log ); } E( p21, challenge, p24 ); return p24; }