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


This egg provides Chicken bindings for the Unix crypt() function. It will attempt to use the system's crypt() for all available types, and supplies fallbacks when the native crypt does not support a given type for common implementations like Niels Provos' bcrypt() and Ulrich Drepper's SHA-2 based crypt().

Basic usage

Basic usage is extremely simple (just like Unix crypt()):

Generating a new password hash:

(use crypt)

(crypt "password") => "$2a$12$eeOD.RHX7kex47wGOu3ZVu2JhRyQBBOyORhd/mTWjQghMWbrxGNCy"

Checking whether a password matches a hash is done like Unix crypt() by checking whether the generated hash matches the input hash:

(use crypt)

(define h "$2a$12$eeOD.RHX7kex47wGOu3ZVu2JhRyQBBOyORhd/mTWjQghMWbrxGNCy")

(string=? (crypt "password" h) h) => #t
(string=? (crypt "wrong" h) h) => #f


 All code in this egg is explicitly placed in the public domain. You may do whatever you want with it.

This egg contains code written by the following people: