summaryrefslogtreecommitdiff
path: root/test/crypt/md5c-test.c
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2002-02-26 15:29:24 +0000
committerEric Andersen <andersen@codepoet.org>2002-02-26 15:29:24 +0000
commit75e3848d490f4a8381b7d73e2f6444b22eeeed34 (patch)
tree544e9e729b86870b154104adafadc8a91733154a /test/crypt/md5c-test.c
parent857146f2320327e2f710be17b475809367bd76b0 (diff)
Add an md5crypt test
Diffstat (limited to 'test/crypt/md5c-test.c')
-rw-r--r--test/crypt/md5c-test.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/crypt/md5c-test.c b/test/crypt/md5c-test.c
new file mode 100644
index 000000000..e2896b5b1
--- /dev/null
+++ b/test/crypt/md5c-test.c
@@ -0,0 +1,19 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <crypt.h>
+
+int
+main (int argc, char *argv[])
+{
+ const char salt[] = "$1$saltstring";
+ char *cp;
+
+ cp = crypt ("Hello world!", salt);
+ if (strcmp ("$1$saltstri$YMyguxXMBpd2TEZ.vS/3q1", cp)) {
+ fprintf(stderr, "Failed md5 crypt test!\n");
+ return EXIT_FAILURE;
+ }
+ fprintf(stderr, "Passed md5 crypt test!\n");
+ return EXIT_SUCCESS;
+}