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

3DES Key Padding error #2

Closed
HJianBo opened this issue Jan 21, 2018 · 2 comments
Closed

3DES Key Padding error #2

HJianBo opened this issue Jan 21, 2018 · 2 comments

Comments

@HJianBo
Copy link

HJianBo commented Jan 21, 2018

3DES encode failed, when the key length greater than 24

See Line 82:

protected String padding(String key){
if (key.length() > 24){
return key.substring(0,23);
}else{
for (int i = key.length() ; i < 24 ; i ++){
key += "0";
}
return key;
}
}

Should be key.substring(0,24)?

@yyduan
Copy link
Collaborator

yyduan commented Jan 22, 2018

the second parameter of substring in java is endIndex , not length.

@yyduan yyduan closed this as completed Jan 22, 2018
@yyduan
Copy link
Collaborator

yyduan commented Jan 22, 2018

This bug will be fixed,thank you!

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