mirror of
https://github.com/ivabus/pantry
synced 2024-11-23 00:45:07 +03:00
21 lines
493 B
C
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;
|
||
|
}
|