我想將我的MD5散列轉換爲4個十六進制數。我的代碼有什麼問題?將散列轉換爲4個十六進制數
//hash = 8ce4b16b22b58894aa86c421e8759df3
char *hash = argv[1];
unsigned int parts[4];
sscanf(&hash[0], "%x", &parts[0]);
sscanf(&hash[8], "%x", &parts[1]);
sscanf(&hash[16], "%x", &parts[2]);
sscanf(&hash[24], "%x", &parts[3]);
printf("Part[0]: %x\n", parts[0]);
printf("Part[1]: %x\n", parts[1]);
printf("Part[2]: %x\n", parts[2]);
printf("Part[3]: %x\n", parts[3]);
你試過'sscanf(&hash [0],「%8x」,&parts [0]);'on? –
謝謝你的伴侶。有用!你可以寫信,我會接受它... – Bakus123