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

Use new obfuscation mode to improve performance #3

Closed
jondy opened this issue Nov 19, 2017 · 2 comments
Closed

Use new obfuscation mode to improve performance #3

jondy opened this issue Nov 19, 2017 · 2 comments
Assignees

Comments

@jondy
Copy link
Contributor

jondy commented Nov 19, 2017

  • Encrypt
    • Compile source to code objects, or load .pyc as code objects
    • Iterate code object, co_code of each code object will be wrapped by an armor as the following format
    0 JUMP_ABSOLUTE            n = 3 + len(bytecode)

         ...                                   here it's obfuscation bytecode by des or some other algorithms

n + 3:
    0 LOAD_GLOBAL              ? (armor)
    3 CALL_FUNCTION            0
    6 POP_TOP
    7 JUMP_ABSOLUTE            0
  • Decrypt
    • For each encrypted code object, first op is jump to n + 3
    • At n + 3, it will call a PyCFunction to decrypt those obfuscation bytecode
    • When it returns, jump to first op of really bytecode

By this way, no import hooker, no setprofile/settrace required. The performance will be improved remarkably.

@jondy jondy self-assigned this Nov 19, 2017
@jondy
Copy link
Contributor Author

jondy commented Nov 19, 2017

It has been implemented, and is testing now. This feature will be released at the end of this month. It's significant for Pyarmor.

@jondy
Copy link
Contributor Author

jondy commented Nov 21, 2017

Released in v3.2.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant