Bob Dunlop wrote:
> Hi,
> 
> On Wed, Apr 02 at 04:28, Russell Gadd wrote:
>> I'm sure one of you gurus will be able to see my error in a trice and
>> enlighten me. As a relative newcomer I am having difficulty with an infinite
> ...
>> #**************** this is the offending line ***********************
>>    echo -e "${PASS1}\n${PASS1}" |bcrypt -r testfile 2> bcryptoutput.txt
> 
> Actually the pipe is not causing the loop it's the poor design of bcrypts
> key input.  bcrypt doesn't check for end of input when reading the key in
> and hence once it's read and rejected the first pair it will loop forever
> processing nothing.  There's no easy fix for this other then getting
> someone to fix bcrypt, or use a different encryption program.
> 
Thanks Bob. I'd use a different encryption program if I could find a 
suitable one. I want something which will record encrypted files on a CD 
in a way which allows a different user with the passphrase (and an 
unencrypted help file on the CD) using either Linux or Windows to read 
it (e.g. an executor of my estate). I don't want to use keypairs as this 
seems to tie the data to me/my PC, so this rules out gpg. Any 
suggestions would be welcome.
> 
> 
> Your method for checking for an error is somewhat baroque as well.  In
> common with most programs bcrypt returns an exit status that indicates
> and error so you could simply do:
> 
> if echo -e "${PASS1}\n${PASS1}" |bcrypt -r testfile 2> bcryptoutput.txt
> then
>     echo all ok
> else
>     echo error:
>     cat  bcryptoutput.txt
> fi
> 
Thanks for the info. Minor question: I read bcrypt's documentation (man 
page and web site) but I don't think it said anything about return 
codes. Maybe there's some other way of discovering this?
Russell