1302778Sasomers/*-
2302778Sasomers * Copyright (c) 2016 Spectra Logic Corporation
3302778Sasomers * All rights reserved.
4302778Sasomers *
5302778Sasomers * Redistribution and use in source and binary forms, with or without
6302778Sasomers * modification, are permitted provided that the following conditions
7302778Sasomers * are met:
8302778Sasomers * 1. Redistributions of source code must retain the above copyright
9302778Sasomers *    notice, this list of conditions and the following disclaimer.
10302778Sasomers * 2. Redistributions in binary form must reproduce the above copyright
11302778Sasomers *    notice, this list of conditions and the following disclaimer in the
12302778Sasomers *    documentation and/or other materials provided with the distribution.
13302778Sasomers *
14302778Sasomers * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
15302778Sasomers * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16302778Sasomers * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17302778Sasomers * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
18302778Sasomers * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19302778Sasomers * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20302778Sasomers * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21302778Sasomers * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22302778Sasomers * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23302778Sasomers * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24302778Sasomers * SUCH DAMAGE.
25302778Sasomers *
26302778Sasomers * $FreeBSD$
27302778Sasomers */
28302778Sasomers
29302778Sasomers#include <err.h>
30302778Sasomers#include <stdio.h>
31302778Sasomers#include <unistd.h>
32302778Sasomers
33302778Sasomersint main(int argc, char** argv)
34302778Sasomers{
35302778Sasomers	char *salt, *pass, *hash;
36302778Sasomers
37302778Sasomers	if (argc < 3)
38302778Sasomers		errx(1, "Usage: crypt <salt> <password>");
39302778Sasomers	salt = argv[1];
40302778Sasomers	pass = argv[2];
41302778Sasomers
42302778Sasomers	hash = crypt(pass, salt);
43302778Sasomers	printf("%s", hash);
44302778Sasomers	return (hash == NULL ? 1 : 0);
45302778Sasomers}
46