https://github.com/foomo/htpasswd
golang htpasswd utilities
https://github.com/foomo/htpasswd
Last synced: 8 months ago
JSON representation
golang htpasswd utilities
- Host: GitHub
- URL: https://github.com/foomo/htpasswd
- Owner: foomo
- License: mit
- Created: 2016-02-12T09:57:50.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2020-01-22T10:12:03.000Z (over 6 years ago)
- Last Synced: 2025-06-04T00:28:58.315Z (about 1 year ago)
- Language: Go
- Size: 9.77 KB
- Stars: 41
- Watchers: 7
- Forks: 19
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README

# This is a simple utility library to manipulate htpasswd files
If you want to authenticate against a htpasswd file use something like https://github.com/abbot/go-http-auth .
## Supported hashing algorithms:
- apr1 (do not use except for legacy support situations)
- sha (do not use except for legacy support situations)
- bcrypt
## This is what you can
Set user credentials in a htpasswd file:
```Go
file := "/tmp/demo.htpasswd"
name := "joe"
password := "secret"
err := htpasswd.SetPassword(file, name, password, htpasswd.HashBCrypt)
```
Remove a user:
```Go
err := htpasswd.RemoveUser(file, name)
```
Read user hash table:
```Go
passwords, err := htpasswd.ParseHtpasswdFile(file)
```
Have fun.