pantry/projects/github.com/besser82/libxcrypt/fixture.c
Marc Seitz ed8b734fd8
+libxcrypt (#785)
Requires -L because the standard library path has precedence on Linux and usually linux has its own lib crypt.

I experimented with trying to use the enable-compat-symlinks (that make xcrypt symlinks) but this option only works if you enable “obsolete modes” which leads to believe it is not wise to do it manually either as other build tools will likely make assumptions based on the filenames.

---------

Co-authored-by: Max Howell <mxcl@me.com>
2023-03-21 15:44:35 -04:00

21 lines
493 B
C

#include <crypt.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>
int main() {
char *hash = crypt("abc", "$2b$05$abcdefghijklmnopqrstuu");
if (errno) {
fprintf(stderr, "Received error: %s", strerror(errno));
return errno;
}
if (hash == NULL) {
fprintf(stderr, "Hash is NULL");
return -1;
}
if (strcmp(hash, "$2b$05$abcdefghijklmnopqrstuuRWUgMyyCUnsDr8evYotXg5ZXVF/HhzS")) {
fprintf(stderr, "Unexpected hash output");
return -1;
}
return 0;
}