We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
BytesType.bytes32PaddedLength() returns incorrect value for lengths greater than 32 and multiples of 32.
BytesType.bytes32PaddedLength()
BytesType::bytes32PaddedLength
@Override public int bytes32PaddedLength() { return value.length <= 32 ? MAX_BYTE_LENGTH : (value.length / MAX_BYTE_LENGTH + 1) * MAX_BYTE_LENGTH; }
In case of the value.length is 64, 96, 128, ... It should return 64, 96, 128, ... However, the results are 96, 128, 160, ...
value.length
The corrected code is as follows:
@Override public int bytes32PaddedLength() { if (value.length < MAX_BYTE_LENGTH) { return MAX_BYTE_LENGTH; } else if (value.length % MAX_BYTE_LENGTH == 0) { return value.length; } else { return (value.length / MAX_BYTE_LENGTH + 1) * MAX_BYTE_LENGTH; } }
If it looks fine, I will create a pull request.
The text was updated successfully, but these errors were encountered:
Merge pull request #2089 from hyperledger/fix/issue-2080
fbcbf82
Fix for #2080
Successfully merging a pull request may close this issue.
Issue_title
BytesType.bytes32PaddedLength()
returns incorrect value for lengths greater than 32 and multiples of 32.Issue_description
BytesType::bytes32PaddedLength
In case of the
value.length
is 64, 96, 128, ...It should return 64, 96, 128, ...
However, the results are 96, 128, 160, ...
Issue_context
The corrected code is as follows:
If it looks fine, I will create a pull request.
The text was updated successfully, but these errors were encountered: