You are looking at historical revision 9306 of this page. It may differ significantly from its current revision.


The stream-htpasswd eggs|egg provides lazy generation and parsing of Apache htpasswd files. The htpasswd files are simple files that the Apache web server (and other related programs such as Subversion) use to keep a table of usernames and hashed passwords.


Consuming an htpasswd file

The following code reads an htpasswd file from current-input-port and prints information from it.

(use stream-ext stream-htpasswd format-modular)

  (lambda (entry)
    (format #t "User: ~A~%  Password hash: ~A~%"
               (stream->string (htpasswd-user entry))
               (stream->string (htpasswd-hash entry))))
  (stream->htpasswd (port->stream)))

Producing an htpasswd file

The following code produces an htpasswd file with a few hard-coded users.

(use stream-htpasswd stream-ext)

(define *users*
    '(("pedro" "9qQnjR7L49qOk")
      ("juan" "9aoaXUqySXwKc")
      ("felix" "Q9i.QlCcFByfs"))))

      (lambda (token)
          (string->stream (car token))
          (string->stream (cadr token))))


This egg is made by Alejandro Forero Cuervo <>.


The stream htpasswd egg for Chicken Scheme is in the public domain and may be reproduced or copied without permission from its author. Citation of the source is appreciated.

The htpasswd record


Reading an htpasswd file


Producing an htpasswd file


Version History

First release.