I\'m trying to write some code to work with an htdigest password file. The documentation I can find seems to claim that the format of that file is:
user:real
echo
by default adds a trailing new line:
echo -n a:b:c | md5
Should work as you expect.
Here is how you set the password for a given user.
sudo htdigest /etc/apache2/.htdigest yourrealm.com yourusername
Hm, I seem to have answered my own question. My test case was flawed, 'echo' is adding extra characters (not sure which). For instance
echo a:b:c | wc
gives 6 characters instead of 5. Calculating the hash at http://md5-hash-online.waraxe.us/ gives the correct value. Sorry everyone!