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

inconsistent result compare to other lib #33

Open
fzxu opened this issue May 2, 2019 · 0 comments
Open

inconsistent result compare to other lib #33

fzxu opened this issue May 2, 2019 · 0 comments

Comments

@fzxu
Copy link

fzxu commented May 2, 2019

Having a big integer, this is the string representation (10 radix): "61112663125671126633722436054102056730607837166180410453588415302234407842306"

The method toDERInteger() which convert to the bigendian bytes would return:
[0, -121, 28, -118, -93, -127, -101, 97, 127, 69, -4, -15, 127, -126, 42, -104, -89, 8, 44, 66, 30, 73, -84, -5, -54, -93, -87, 83, -28, 113, 30, 50, 2]

But the same method from pointycastle returns:
https://github.com/PointyCastle/pointycastle/blob/master/lib/src/utils.dart#L21

unsigned:
[135, 28, 138, 163, 129, 155, 97, 127, 69, 252, 241, 127, 130, 42, 152, 167, 8, 44, 66, 30, 73, 172, 251, 202, 163, 169, 83, 228, 113, 30, 50, 2]

convert to signed:
[-121, 28, -118, -93, -127, -101, 97, 127, 69, -4, -15, 127, -126, 42, -104, -89, 8, 44, 66, 30, 73, -84, -5, -54, -93, -87, 83, -28, 113, 30, 50, 2]

Wondering what is the leading 0...

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

1 participant