33import sys
44import traceback
55import types
6+ from functools import lru_cache
67from importlib import abc , machinery
78from importlib ._bootstrap_external import _NamespacePath
89from importlib .machinery import ModuleSpec
@@ -49,6 +50,11 @@ def _init_license_path(self) -> None:
4950 self .license_path = path
5051 break
5152
53+ @classmethod
54+ @lru_cache (maxsize = 128 )
55+ def _decrypt_key (cls , cipher_key : str , d : int , n : int ):
56+ return decrypt_key (cipher_key , d , n )
57+
5258 def check (self ) -> bool :
5359 if self .license is False :
5460 return False
@@ -58,7 +64,7 @@ def check(self) -> bool:
5864
5965 __n , __d = self .__private_key .split ("O" , 1 )
6066 check_license (
61- self .license_path , decrypt_key (self .__cipher_key , int (__d ), int (__n ))
67+ self .license_path , self . _decrypt_key (self .__cipher_key , int (__d ), int (__n ))
6268 )
6369 return True
6470
@@ -72,7 +78,7 @@ def get_data(self, path: _Path) -> bytes:
7278 try :
7379 __n , __d = self .__private_key .split ("O" , 1 )
7480 return decrypt_file (
75- Path (path ), decrypt_key (self .__cipher_key , int (__d ), int (__n ))
81+ Path (path ), self . _decrypt_key (self .__cipher_key , int (__d ), int (__n ))
7682 )
7783 except Exception :
7884 traceback .print_exc ()
0 commit comments