bitcookies / winrar-keygen

Principle of WinRAR key generation.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

InternalError: The length of register data is not correct.

Sonic-The-Hedgehog-LNK1123 opened this issue · comments

The error InternalError: The length of register data is not correct. is sometimes returned while generating a key.

After some testing, I discovered that the length checks that should prevent that error in the first place, are incorrect.

first:

if (LicenseTypeSignatureR.length() <= 60 && LicenseTypeSignatureS.length() <= 60) {

Pad with zeros, and <= should be == :

if (LicenseTypeSignatureR.length() < 60) {
    LicenseTypeSignatureR.insert(LicenseTypeSignatureR.begin(), 60 - LicenseTypeSignatureR.size(), '0');
}
if (LicenseTypeSignatureS.length() < 60) {
    LicenseTypeSignatureS.insert(LicenseTypeSignatureS.begin(), 60 - LicenseTypeSignatureS.size(), '0');
}
if (LicenseTypeSignatureR.length() == 60 && LicenseTypeSignatureS.length() == 60) { 

second:

if (UserNameSignatureR.length() <= 60 || UserNameSignatureS.length() <= 60) {

same as above, and || should be &&:

if (UserNameSignatureR.length() < 60) {
    UserNameSignatureR.insert(UserNameSignatureR.begin(), 60 - UserNameSignatureR.size(), '0');
}
if (UserNameSignatureS.length() < 60) {
    UserNameSignatureS.insert(UserNameSignatureS.begin(), 60 - UserNameSignatureS.size(), '0');
}
if (UserNameSignatureR.length() == 60 && UserNameSignatureS.length() == 60) { 

These changes should get rid of that error.

Cool 😎. Many thanks, fix it later.

Done 😎