Skip to content

Commit

Permalink
Ensure checksum is always 4 digits
Browse files Browse the repository at this point in the history
  • Loading branch information
zionsg committed Mar 10, 2021
1 parent bfa4e52 commit 5d25096
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/SgQr/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public function computeChecksum($text, $polynomialHex = 0x1021, $initialValue =
}
}

return strtoupper(dechex($result));
return str_pad(strtoupper(dechex($result)), 4, '0', STR_PAD_LEFT); // ensure 4 chars cos result may be shorter
}

/**
Expand Down

0 comments on commit 5d25096

Please sign in to comment.