BITMAG-1133: Reference client understands salt input as a Hex String. This is NOT clear from the docs#26
Merged
m-atlantis merged 8 commits intomasterfrom Jun 23, 2022
Conversation
…ry calls enforcing correct use which old ones didn't, and fixed SaltedChecksumWorkflow/tests accordingly
…before and actually fixed all the affected tests this time (see last commit)
…s Codec-implementation - should have better performance
ole-v-v
approved these changes
Jun 21, 2022
| cmdHandler.addOption(checksumSaltOption); | ||
|
|
||
| Option deleteOption = new Option(Constants.DELETE_FILE_ARG, Constants.NO_ARGUMENT, | ||
| "If this argument is present, then the file will be removed from the server, when the chosen operation is complete."); |
Contributor
There was a problem hiding this comment.
Nitpicking now we're at it: remove the second comma, the one between "server" and "when".
| for (int i = 0; i < len; i += 2) { | ||
| data[i / 2] = (byte) ((Character.digit(hexString.charAt(i), 16) << 4) | ||
| + Character.digit(hexString.charAt(i + 1), 16)); | ||
| // TODO Java 17 has HexFormat.of().parseHex(s) - consider using instead |
| sb.append(Integer.toHexString(v)); | ||
| } | ||
| return sb.toString(); | ||
| return Hex.encodeHexString(data); |
Contributor
There was a problem hiding this comment.
Similarly to below one may consider adding a comment along the lines of TODO Java 17 has HexFormat.of().formatHex(bytes); - consider using instead.
Contributor
Author
There was a problem hiding this comment.
I actually did write this, but somehow I deleted it again. Will add. :)
… Put- and ReplaceFileCmd used this
m-atlantis
approved these changes
Jun 23, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixed the issue and also changed underlying Base16Utils a bit.
Base16Utils now enforces correct use - i.e. input string has even length and consists only of hexadecimal characters.
This entails that e.g. running the following using the commandline client:
bitmag.sh put-file -f <file> -c <collection> -C <checksum> -R <checksum_type> -S saltwill now throw an error, as the string salt does not only consist of hexadecimals.