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

add get_contacts_hash #24

Closed
wants to merge 1 commit into from
Closed

Conversation

@1pyxa1
Copy link
Contributor

@1pyxa1 1pyxa1 commented Feb 21, 2018

No description provided.

Copy link
Member

@delivrance delivrance left a comment

Thanks! This will come in handy when Pyrogram will persistently save contacts on disk, but this algorithm looks a bit different than the one I saw. Where did you take this from?

@delivrance
Copy link
Member

@delivrance delivrance commented Feb 21, 2018

Also, I don't like having @staticmethods inside the Client class this way. This method and probably some others too will face a refactor and will be moved to something like a utils.py module

@1pyxa1
Copy link
Contributor Author

@1pyxa1 1pyxa1 commented Feb 21, 2018

if you are talking about

def hash20261_32(ints):
    acc = 0
    for id in ints:
            acc = (acc * 20261 * 20261 + id) & 0xffff_ffff
    return acc & 0xffff_ffff

or something similar, it was not working for me. i got the algorithm from https://github.com/DrKLO/Telegram

@delivrance delivrance force-pushed the pyrogram:master branch from a94cf96 to 3d3c1e2 May 1, 2018
@delivrance delivrance closed this Jul 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.