I have the following code segment I am testing for an encryption program I am to wirte. Namely the blowfish algorithm. I am to input from the command line up to a 64 bit hex number and convert it to a base ten number. I am using the code segment on a Dell 64 bit server with ubuntu server 64 installed using gcc from the command line. What seems to be happening is it is only converting the first 32 bits. Here is what I am inputing:
Code:
48656c6c6f20576f726c642120486f77277320697420676f696e673f
and this is what my output is:
Code:
18446744073709551615
Here is my code segment:
Code:
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
char buffer[64];
unsigned long long ul;
printf("Enter an unsigned number: ");
fgets(buffer, 64, stdin);
ul = strtoull (buffer, NULL, 16);
printf("Output: %llu\n", ul);
return 0;
}
What am I doing incorrect here and what can be done to correct it.
Thanks in advance!