mirror of
https://github.com/ivabus/pantry
synced 2024-11-25 09:55:06 +03:00
ed8b734fd8
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>
20 lines
493 B
C
20 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;
|
|
}
|