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

Different results between int and String #79

Open
Sulley93 opened this issue Jun 11, 2024 · 1 comment
Open

Different results between int and String #79

Sulley93 opened this issue Jun 11, 2024 · 1 comment

Comments

@Sulley93
Copy link

If I call md5 with an integer parameter it return a different value from md5 called with a string parameter.
e.g.
md5(1003) = 64e0407ffc70c04a366526a7065cbd05
md5('1003') = aa68c75c4a77c87f97fb686b2f068676.

Is it a normal behavior?

@pvorb
Copy link
Owner

pvorb commented Jun 11, 2024

Yes, this is "normal". Don't use this library. It will happily help you shoot yourself in the foot.

MD5 is an algorithm that is defined on binary input data. This library just does whatever your runtime will do to make your input binary. So, if your runtime will serialize strings in UTF-16 rather than UTF-8, you'd get different results for the same input string.

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

No branches or pull requests

2 participants