Path: csiph.com!xmission!feeder.erje.net!1.eu.feeder.erje.net!news-1.dfn.de!news.dfn.de!news.informatik.hu-berlin.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Lothar Kimmeringer Newsgroups: sci.crypt,comp.lang.java.programmer Subject: Re: Why is Java 7 converting the Password toCharArray instead of Byte in it's PBKDF2 function? Date: Tue, 19 Jun 2018 22:18:44 +0200 Organization: Organization?! Only chaos here! Lines: 25 Message-ID: References: Reply-To: news@kimmeringer.de Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: individual.net XeqCfGVg0jX//orQu4xq0wUBgjqzF1FTQx5O4DsBllcWvt0btT Cancel-Lock: sha1:KCu67wWgYqgha+WNVDQ+kjgKRBs= User-Agent: 40tude_Dialog/2.0.15.1de Xref: csiph.com sci.crypt:43717 comp.lang.java.programmer:38392 Karl.Frank wrote: > The amount of byte to read is exactly defined by > > int BuffSize = System.in.available(); > byte[] pwByte = new byte[BuffSize]; > System.in.read(pwByte, 0, BuffSize); > > How would the program read more byte than necessary? InputStream.available only returns the number of bytes that can be read without blocking. Dependent on how the data ends up there there still might be data left to read that you missed because of that. What you're doing here is a common programming error. Cheers, Lothar -- Lothar Kimmeringer E-Mail: spamfang@kimmeringer.de PGP-encrypted mails preferred (Key-ID: 0x8BC3CD81) Always remember: The answer is forty-two, there can only be wrong questions!