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

Fix reverseHex method for inputs with an odd number of digits #28

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

HalibutGitWiz
Copy link

Util::reverseHex does not behave correctly when the input has an odd number of digits

echo Rats\Zkteco\Lib\Helper\Util::reverseHex('13E7'); // Outputs "E713", OK
echo Rats\Zkteco\Lib\Helper\Util::reverseHex('3E7'); // Outputs "E7", KO, should output E703

This can happen in real world usage when creating / updating the card ID of an user. The result is an incorrect card ID in the device.

This fix corrects this behavior by adding a leading zero so the input always has an even number of digits.

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

Successfully merging this pull request may close these issues.

None yet

1 participant