Keep leading zero bytes in salt, based on gist by @Gdocal #61
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Apple iCloud login recently switched to using SRP. In an effort to get the Python-based iCloud wrappers (like https://github.com/picklepete/pyicloud and https://github.com/gcobb321/icloud3_v3), it was discovered that the SRP implementation between the Apple original JS login, and the pysrp Python library differed in some cases.
The difference was tracked down by @Gdocal in an heroic effort to be the handling of leading zeros in the salt, where Apple keep them but pysrp loses them, due to a conversion of the salt to a long value instead of keeping it byte-by-byte.
This PR is a cleaned-up version of the patch published by @Gdocal at https://gist.github.com/Gdocal/45c24f542ebd32a2256217bfd856d972. All credit for writing this patch goes to him; I just removed some debug comment and reverted spurious changes.
This is of course not the only way possible to solve the issue; feel free to ignore this PR and implement another solution yourself.