xref: /freebsd/lib/libcrypt/crypt.h (revision b3e76948)
1bf513f69SMark Murray /* LINTLIBRARY */
25e53a4f9SPedro F. Giffuni /*-
34d846d26SWarner Losh  * SPDX-License-Identifier: BSD-2-Clause
45e53a4f9SPedro F. Giffuni  *
5e9a56ad5SMark Murray  * Copyright (c) 1999
6e9a56ad5SMark Murray  *      Mark Murray.  All rights reserved.
7e9a56ad5SMark Murray  *
8e9a56ad5SMark Murray  * Redistribution and use in source and binary forms, with or without
9e9a56ad5SMark Murray  * modification, are permitted provided that the following conditions
10e9a56ad5SMark Murray  * are met:
11e9a56ad5SMark Murray  * 1. Redistributions of source code must retain the above copyright
12e9a56ad5SMark Murray  *    notice, this list of conditions and the following disclaimer.
13e9a56ad5SMark Murray  * 2. Redistributions in binary form must reproduce the above copyright
14e9a56ad5SMark Murray  *    notice, this list of conditions and the following disclaimer in the
15e9a56ad5SMark Murray  *    documentation and/or other materials provided with the distribution.
16e9a56ad5SMark Murray  *
17e9a56ad5SMark Murray  * THIS SOFTWARE IS PROVIDED BY MARK MURRAY AND CONTRIBUTORS ``AS IS'' AND
18e9a56ad5SMark Murray  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19e9a56ad5SMark Murray  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20e9a56ad5SMark Murray  * ARE DISCLAIMED.  IN NO EVENT SHALL MARK MURRAY OR CONTRIBUTORS BE LIABLE
21e9a56ad5SMark Murray  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22e9a56ad5SMark Murray  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23e9a56ad5SMark Murray  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24e9a56ad5SMark Murray  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25e9a56ad5SMark Murray  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26e9a56ad5SMark Murray  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27e9a56ad5SMark Murray  * SUCH DAMAGE.
28e9a56ad5SMark Murray  *
29e9a56ad5SMark Murray  */
30e9a56ad5SMark Murray 
31e9a56ad5SMark Murray /* magic sizes */
32bf513f69SMark Murray #define MD4_SIZE 16
33e9a56ad5SMark Murray #define MD5_SIZE 16
34e9a56ad5SMark Murray 
355f521d7bSEd Schouten int crypt_des(const char *pw, const char *salt, char *buf);
365f521d7bSEd Schouten int crypt_md5(const char *pw, const char *salt, char *buf);
375f521d7bSEd Schouten int crypt_nthash(const char *pw, const char *salt, char *buf);
385f521d7bSEd Schouten int crypt_blowfish(const char *pw, const char *salt, char *buf);
395f521d7bSEd Schouten int crypt_sha256 (const char *pw, const char *salt, char *buf);
405f521d7bSEd Schouten int crypt_sha512 (const char *pw, const char *salt, char *buf);
41e9a56ad5SMark Murray 
42f2ac424aSMark Murray extern void _crypt_to64(char *s, u_long v, int n);
435f521d7bSEd Schouten extern void b64_from_24bit(uint8_t B2, uint8_t B1, uint8_t B0, int n, char **cp);
44