Added initial pwcrypt.c and Makefile
[staff/wgh1/pwcrypt.git] / Makefile
1 #
2 # Makefile for pwcrypt
3 #
4 # (c) 2016 WGH1@BFH
5 #
6 #
7
8 # Compiler to use
9 CC=gcc
10
11 # Password generator to use (for demo)
12 PG=pwgen
13
14 all: pwcrypt test demo
15
16 # Compile pwcrypt
17 pwcrypt: pwcrypt.c
18 $(CC) pwcrypt.c -l crypt -o pwcrypt
19
20 # Test with SHA-512 encryption (first $ masks second $)
21 test=$(shell ./pwcrypt '$$6$$__Salt__$$' '& __Pepper__')
22 test: pwcrypt
23 @echo 'Hash: $(test)'
24
25 # Demo with SHA-512 ("pwgen" required for random salt & pepper)
26 demo=$(shell ./pwcrypt '$(salt)' '$(pepper)')
27 demo: pwcrypt salt pepper
28 @echo 'Hash: $(demo)'
29
30 # Salt for demo
31 salt:=$$6$$$(shell $(PG) -1)$$
32 salt: pwgen
33 @echo 'Salt: $(salt)'
34
35 # Pepper (Password) for demo
36 pepper:=$(shell $(PG) -1 12)
37 pepper: pwgen
38 @echo 'Pass: $(pepper)'
39
40 # Check if pwgen is installed on the system
41 pwgen:
42 @which $(PG) > /dev/null || echo Install "$(PG)" first
43
44 # remove pwcrypt binary
45 clean:
46 -rm pwcrypt