-
-
Notifications
You must be signed in to change notification settings - Fork 11.6k
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
qsort is not equivalent to the original sorting algorithm #1
Comments
Got it, I will try to implement a merge sort instead. By the way, current android client is a porting of shadowsocks-go with cross compiled binary using cgo. I am still working on the libev implementation and the related codes should be buggy. Thanks, |
17 tasks
ghost
mentioned this issue
Aug 31, 2017
13 tasks
madeye
pushed a commit
that referenced
this issue
Mar 24, 2018
FakeTrader
pushed a commit
to FakeTrader/shadowsocks-android
that referenced
this issue
Aug 21, 2018
Closed
17 tasks
17 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I find a bug when I try to port your code to iOS. qsort is not equivalent to the original code. It's not a stable sorting algorithm, so it will generate a different cipher with the one generated by Python or node.js server.
You can find the right implementation with bubble sort here:
https://github.com/clowwindy/shadowsocks-libev/blob/master/encrypt.c
If you want to speed up the calculation, use merge sort, which is a stable sorting algorithm with n*log(n) complexity.
The text was updated successfully, but these errors were encountered: