#6670·caddy

Feature Request: support modules implementing http.authentication.hashes

Author: marvinlwenzelCreated Nov 1, 2024Updated Sep 25, 2026

Hello.

Caddy Name Spaces lists http.authentication.hashes as a namespace for custom implementations for hashing in use with basic_auth and caddy-hash-password.

As of 2.8.4, there appears to be no check for modules implementing http.authentication.hashes. Just hard coded cases going "bcrypt or bust". https://github.com/caddyserver/caddy/blob/350ad38f63f7a49ceb3821c58d689b85a27ec4e5/modules/caddyhttp/caddyauth/command.go#L109-L115 https://github.com/caddyserver/caddy/blob/350ad38f63f7a49ceb3821c58d689b85a27ec4e5/modules/caddyhttp/caddyauth/caddyfile.go#L65-L69

The basic_auth Docu states

<hash_algorithm> is the name of the password hashing algorithm (or KDF) used for the hashes in this configuration. Default: bcrypt

caddy-hash-password states

--algorithm may be bcrypt or any installed hash algorithm. Default is bcrypt.

Those seem misleading in the first case and false in the second.

I would like to change that.

I have started working on this to get an understanding of challenges and impact to get a proper discussion started. (So far, I was able to have both bcrypt and a custom alternative working without observing bugs. No tests, performance tests, or anything done yet. If you want to have a look: https://github.com/marvinlwenzel/caddyCrypt, my current diff https://github.com/caddyserver/caddy/compare/master...marvinlwenzel:caddyCrypt:master and the custom hash impl https://github.com/marvinlwenzel/fvttcrypt)

  1. Given that the doc suggests that adding a custom hasher should be possible and the necessary interfaces offer the needed abstraction, I assume that would be a feature the project is generally interested in.
  2. I guess the impact on non-test-code would be relatively small from what I have been able to test manually and from looking into the code base.
  3. Right now I have no idea what the scope of test code would be. Before I dive into that (and ask for guidance as my golang-integ-test-experience is zero), I wanted to start the discussion to avoid wasted effort.

Should http.authentication.hashes modules be supported, or is this too niche of a scenario to be relevant? Is there more to be considered when this is tackled than what I stated thus far (more config, guidelines on hash formats, idk...)?