Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InternalError: The length of register data is not correct. #6

Closed
Sonic-The-Hedgehog-LNK1123 opened this issue Dec 4, 2021 · 2 comments

Comments

@Sonic-The-Hedgehog-LNK1123
Copy link

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.

@bitcookies
Copy link
Owner

Cool 😎. Many thanks, fix it later.

@bitcookies
Copy link
Owner

Done 😎

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants