Skip to content

Commit

Permalink
Handling null in checksum validation
Browse files Browse the repository at this point in the history
  • Loading branch information
Sumanth Pasupuleti authored and sumanth-pasupuleti committed Aug 4, 2021
1 parent e22f93c commit ee6b3e6
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,14 @@ public static String appendCheckSumAndEncodeBase64(String inputString, boolean a
* Base64 decodes the input string, extracts original string bytes and checksum bytes, generates checksum from the
* extracted string bytes, and validates against the extracted checksum bytes.
* @param encodedInput
* @return true if the checksum is correct, false otherwise
* @return true if the checksum is correct or if the encodedInput is null, false otherwise.
*/
public static boolean isChecksumValid(String encodedInput)
{
// ignore null input
if (null == encodedInput)
return true;

try
{
byte[] inputInBytes = Base64.getDecoder().decode(encodedInput);
Expand Down

0 comments on commit ee6b3e6

Please sign in to comment.