On a second question can anyone tell me why these two commands result in a different hash?
Command: echo '<?php print sha1("password")."\n"; ?>' | php
Command: echo 'password' | sha1sum
You would need to do this as the second command:
echo -n 'password' | sha1sum
Otherwise the 'echo'-command adds a trailing newline character.