Fix: Use Md5 new interface, and fmt
This commit is contained in:
@@ -765,35 +765,22 @@ struct LoginWindow : Window {
|
|||||||
SetLoginItem(INI_LOGIN_KEYS[this->query_widget - 3], item); // - LWW_NICE_LOGIN + NICE_LOGIN
|
SetLoginItem(INI_LOGIN_KEYS[this->query_widget - 3], item); // - LWW_NICE_LOGIN + NICE_LOGIN
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case LQW_NICE_PW:
|
case LQW_NICE_PW: {
|
||||||
{
|
Md5 password, salted_password;
|
||||||
/* FIXME: create and save the md5salt */
|
MD5Hash digest;
|
||||||
Md5 password, salted_password;
|
|
||||||
password.Append(str, strlen(str));
|
password.Append(str, strlen(str));
|
||||||
uint8 digest[16];
|
password.Finish(digest);
|
||||||
char hex_output[16 * 2 + 1];
|
auto first_pass = fmt::format("{:02x}", fmt::join(digest, ""));
|
||||||
/* 1st ERROR: cannot convert argument 1 from uint8_t[16] to 'MD5HASH &' */
|
|
||||||
/*
|
auto tobe_salted = fmt::format("nice{}client", first_pass);
|
||||||
password.Finish(digest);
|
salted_password.Append(tobe_salted.c_str(),tobe_salted.length());
|
||||||
for (int di = 0; di < 16; ++di){
|
salted_password.Finish(digest);
|
||||||
// 2nd ERROR: seprintf
|
auto second_pass = fmt::format("{:02x}", fmt::join(digest, ""));
|
||||||
seprintf(hex_output + di * 2,lastof(hex_output), "%02x",digest[di]);
|
|
||||||
}
|
// Save the result to citymania.cfg
|
||||||
char tobe_salted[4 + 16 * 2 + 6 + 1] = {0};
|
SetLoginItem(NICE_PW, second_pass);
|
||||||
//3rd ERROR: strecat
|
break;
|
||||||
strecat(tobe_salted, "nice", lastof(tobe_salted));
|
|
||||||
strecat(tobe_salted + 4, hex_output,lastof(tobe_salted));
|
|
||||||
strecat(tobe_salted + 4 + 16 * 2, "client",lastof(tobe_salted));
|
|
||||||
assert(strlen(tobe_salted) == (sizeof(tobe_salted) - 1));
|
|
||||||
salted_password.Append(tobe_salted,strlen(tobe_salted));
|
|
||||||
salted_password.Finish(digest);
|
|
||||||
for (int di = 0; di < 16; ++di){
|
|
||||||
seprintf(hex_output + di * 2,lastof(hex_output), "%02x",digest[di]);
|
|
||||||
}
|
|
||||||
// Save the result to citymania.cfg
|
|
||||||
SetLoginItem(NICE_PW, hex_output);
|
|
||||||
*/
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
default: return;
|
default: return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user