-
Notifications
You must be signed in to change notification settings - Fork 191
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
to_bytes_le on BigUInt strips trailing zero(es) #201
Comments
Python can even tell you that your number's You can pad your Rust byte vector to the desired size with |
Thanks for the quick reply. I did end up fixing it by padding the vector just as you said. This just caught me off guard because I could not find any mention of this anywhere in the docs, though I am not sure where I would put this. If this is expected behavior feel free to close the issue. |
It would be great if this library added the functions |
Found a strange edge case with one number I was working with, this is a binary saved sha1 hash for those curious and is throwing off everything I am doing. Providing a python3 example code to show what the value should be.
Basically this should result in vector of length 20 but ends up being length 19 because of the last element being 0 I suspect this line being the issue https://github.com/rust-num/num-bigint/blob/master/src/biguint/convert.rs#L598. I have no inner knowledge how you store your data so I have no idea how and why the check is done this way.
Reproduction
Working example in python
The text was updated successfully, but these errors were encountered: