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

feat(player): improved decipher logic #79

Merged
merged 6 commits into from
Jun 21, 2022
Merged

Conversation

Wykerd
Copy link
Collaborator

@Wykerd Wykerd commented Jun 20, 2022

  • Improve the deciphering logic for Signatures and NTokens.
  • This makes NToken transforms more than 20x faster (on my M1 Pro its down from 1.7ms to 0.06ms)
  • It also improves caching of the player drastically, by only keeping the processed responses in binary format, bringing down the cache per player from 1.8MB to less than 400 bytes

These improvements where originally written in TypeScript but I did not think it would be appropriate to add a build step to this project, so I compiled it down to JavaScript before adding to this project. You can view the original files here

Wykerd and others added 4 commits June 20, 2022 21:28
- Improve the deciphering logic for Signatures and NTokens.
- This makes NToken transforms more than 20x faster
- It also improves caching of the player drastically, by only keeping
the processed responses in binary format. Bringing down the cache
per player from 1.8MB to less than 400 bytes
@Wykerd Wykerd marked this pull request as ready for review June 20, 2022 20:02
@Wykerd Wykerd requested a review from LuanRT June 20, 2022 20:02
@LuanRT
Copy link
Owner

LuanRT commented Jun 20, 2022

Great! Do note however that Google is constantly tweaking the microlanguage used in the NToken algorithm, I see this adds a bit of complexity around that and might make it more difficult to fix something if they push a major change. Also, maybe we should include the original typescript files in the same folder alongside the compiled deciphers?

Edit:
After some testing it seems to be working as expected. I still suggest to have either the original files together with their compiled versions or a pure JavaScript implementation tho.

@Wykerd
Copy link
Collaborator Author

Wykerd commented Jun 21, 2022

Great! Do note however that Google is constantly tweaking the microlanguage used in the NToken algorithm, I see this adds a bit of complexity around that and might make it more difficult to fix something if they push a major change. Also, maybe we should include the original typescript files in the same folder alongside the compiled deciphers?

Edit: After some testing it seems to be working as expected. I still suggest to have either the original files together with their compiled versions or a pure JavaScript implementation tho.

A pure Javascript implementation would look pretty much identical to this, its only the enums thats a bit hard to read after the compilation step.

@LuanRT LuanRT merged commit 1681a9b into main Jun 21, 2022
@Wykerd Wykerd deleted the Wykerd-player-refactor branch June 30, 2022 18:39
@Wykerd Wykerd added this to the v2 milestone Jul 13, 2022
@LuanRT LuanRT added the bug Something isn't working label Sep 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants