by jbarham

jbarham / cdb

Pure Go implementation of D. J. Bernstein's cdb constant database library.

201 Stars 13 Forks Last release: Not found BSD 2-Clause "Simplified" License 22 Commits 0 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:


This is a Go package to read and write cdb ("constant database") files.

The cdb file format is a machine-independent format with the following features:

  • Fast lookups: A successful lookup in a large database normally takes just two disk accesses. An unsuccessful lookup takes only one.
  • Low overhead: A database uses 2048 bytes, plus 24 bytes per record, plus the space for keys and data.
  • No random limits: cdb can handle any database up to 4 gigabytes. There are no other restrictions; records don't even have to fit into memory.

See the original cdb specification and C implementation by D. J. Bernstein at


Assuming you have a working Go environment, installation is simply:

go get

The package documentation can be viewed online at or on the command line by running

go doc

The included self-test program

illustrates usage of the package.


The cdb package includes ports of the programs

from the original implementation.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.