public static boolean checkpw(byte[] plaintext0,final String hashed){
  byte hashed_bytes[];
  byte try_bytes[];
  try {
    final String try_pw=hashpw(plaintext0,hashed);
    hashed_bytes=hashed.getBytes("UTF-8");
    try_bytes=try_pw.getBytes("UTF-8");
  }
 catch (  final UnsupportedEncodingException uee) {
    return false;
  }
 finally {
    if (plaintext0 != null) {
      Arrays.fill(plaintext0,(byte)'\0');
      plaintext0=null;
    }
  }
  if (hashed_bytes.length != try_bytes.length) {
    return false;
  }
  byte ret=0;
  for (int i=0; i < try_bytes.length; i++) {
    ret|=hashed_bytes[i] ^ try_bytes[i];
  }
  return ret == 0;
}

public static boolean checkpw ( byte [ ] plaintext0 , final String hashed ) { byte hashed_bytes [ ] ; byte try_bytes [ ] ; try { final String try_pw = hashpw ( plaintext0 , hashed ) ; hashed_bytes = hashed . getBytes ( "UTF-8" ) ; try_bytes = try_pw . getBytes ( "UTF-8" ) ; } catch ( final UnsupportedEncodingException uee ) { return false ; } finally { if ( plaintext0 != null ) { Arrays . fill ( plaintext0 , ( byte ) '\0' ) ; plaintext0 = null ; } } if ( hashed_bytes . length != try_bytes . length ) { return false ; } byte ret = 0 ; for ( int i = 0 ; i < try_bytes . length ; i ++ ) { ret |= hashed_bytes [ i ] ^ try_bytes [ i ] ; } return ret == 0 ; }
check that a plaintext password matches a previously hashed one
