# ri > WEBrick::HTTPAuth::Htdigest

---
type: CommandReference
command: WEBrick::HTTPAuth::Htdigest
mode: perldoc
section: 
source: perldoc
---

## Quick Reference

- `WEBrick::HTTPAuth::Htdigest.new('my_password_file')` — create a new Htdigest object
- `htpasswd.set_passwd('my realm', 'username', 'password')` — set password for user in realm
- `htpasswd.flush` — flush changes to password file

## Name

Htdigest accesses apache-compatible digest password files. Passwords are matched to a realm where they are valid. For security, the path for a digest password database should be stored outside of the paths available to the HTTP server. Includes UserDB module.

## Synopsis

ruby
htpasswd = WEBrick::HTTPAuth::Htdigest.new 'my_password_file'
htpasswd.set_passwd 'my realm', 'username', 'password'
htpasswd.flush
## Options (Methods)

**Class methods:**
- `new` — creates a new Htdigest instance

**Instance methods:**
- `delete_passwd` — deletes a password entry
- `each` — iterates over password entries
- `flush` — writes changes to the password file
- `get_passwd` — retrieves a password for a user/realm
- `reload` — reloads the password file from disk
- `set_passwd` — sets a password for a user in a realm

## Examples

ruby
htpasswd = WEBrick::HTTPAuth::Htdigest.new 'my_password_file'
htpasswd.set_passwd 'my realm', 'username', 'password'
htpasswd.flush
## See Also

- [WEBrick::HTTPAuth::DigestAuth](http://localhost/phpMan.php/perldoc/WEBrick%3A%3AHTTPAuth%3A%3ADigestAuth/markdown)