htdigest file format

后端 未结 3 947
野的像风
野的像风 2020-12-18 02:39

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         


        
相关标签:
3条回答
  • 2020-12-18 02:56

    echo by default adds a trailing new line:

    echo -n a:b:c | md5
    

    Should work as you expect.

    0 讨论(0)
  • 2020-12-18 03:00

    Here is how you set the password for a given user.

    sudo htdigest /etc/apache2/.htdigest yourrealm.com yourusername
    
    0 讨论(0)
  • 2020-12-18 03:02

    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!

    0 讨论(0)
提交回复
热议问题