So just to make sure im not just completely confusing myself, I wanted to make sure I understood the crypt function.
So I have some simple code:
#define _XOPEN_SOURCE
#include <cs50.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
const int MAX_SIZE = 4;
const int SALT_LENGTH = 2;
const int WORD_MAX = 128;
int main(int argc, string argv[])
{
if (argc != 2){
printf("Usage: ./crack hash");
return 1;
}
char *cipher = argv[1]; //cipher
char *pass = "caesar";
char *salty = "50";
char *stuff;
stuff = crypt(pass,salty);
for(int a = 0;a < strlen(stuff);a++)
{
printf("%c",stuff[a]);
}
if(strcmp(stuff, cipher) == 0)
{
printf("YAY");
}
return 0;
}
So I know (From the CS50 website that the salt being used is 50 (since it's always listed first in the encrypted password) and I know on the CS50 site "caesar" is "50zPJlUFIYY0o" according to the 2016 page
So how come when I run this, I get something completely different?
50psJDBxuKJdQ
Is what I get?
I mean I must be missing something here, obviously this isn't even close to the "full code" but if I can't even get the crypt function "using" right Im probably gonna struggle on the rest.
Any ideas?