For the purpose of obfuscation, we will be using a python package called pyarmor.

We might sometimes face a situation where we need to provide code directly to a client for obvious reasons, but by doing so, we will lose control of the code. In such cases, we might we encrypt the codes to protect it, retain control and add some fallback condition to control our dependency, just like if we provided code for using only for a certain amount of time.

To address the above issues, I will be demonstrating a simple function with the above capabilities. We will be making use of the python library called “pyarmor”.

Table of Contents:

  1. Creating a simple function
  2. Using pyarmor to encrypt it
  3. Importing our function / Inference


How to Hide/Encrypt/Obfuscate any Python Program
2.15 GEEK