What I am searching for is a decrypt function to the crypt(3)
function. Reading the manual they only refer me to see login(1), passwd(1), encrypt(3), getpass(3), passwd(5)
, but as far as I am aware, non of them can be used to decrypt the string.
I wrote together a small program to show my point, the function I am looking for is the somefunctogetbackplaintext(...)
#define _XOPEN_SOURCE
#include <unistd.h>
#include <string.h>
#include <stdio.h>
int
main(int argc, char *argv[])
{
char *cryptated = crypt(argv[1], "aa"); // Password and salt
if(strcmp("somepassword", somefunctogetbackplaintext(argv[1], cryptated, "aa"))) //Plain text, cryptated string, salt
{
printf("Success!\n");
}
else
{
printf("Not a success!\n");
}
return 0;
}