/* Copyright 1989, 1990 by James Aspnes, David Applegate, and Bennet Yee */ /* See the file COPYING for distribution information */ #include "os.h" #include "db.h" const char *alphabet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789./"; const char *encrypt_password (const char *password) { char salt[3]; salt[0] = alphabet[RAND () % 64]; salt[1] = alphabet[RAND () % 64]; salt[2] = '\0'; return crypt (password, salt); } int check_password (const char *clear, const char *encrypted) { return !strcmp (encrypted, crypt (clear, encrypted)); }