怎样对 Python 源码加密?
大家讲道理
大家讲道理 2017-04-17 13:37:22
0
8
461

PHP 可以使用 Zend Guard 对源码加密,然后发布使用。
想知道 Python 有没有类似的加密工具,加密后的代码仍然可以运行。

大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

reply all (8)
左手右手慢动作

Just publish the pyc file generated by compiling the python source code
python -m py_compile src.py

http://my.oschina.net/wizardpisces/blog/107445

    大家讲道理

    In fact, encryption is very simple. Modify the code of the Python virtual machine, modify the virtual code for the part where pyc is compiled, or swap a few. No one else can figure it out. This method comes from (Yunfeng Daxia) (from the book "My Programming Insights")
    The disadvantage is also obvious, you must use your own modified Python virtual machine when executing.

      巴扎黑

      At best, it is just confusion. It is impossible to achieve encryption in the true sense. This is the nature of interpreted languages.

        Peter_Zhu

        You can use this python obfuscator to encrypt.
        The encryption effect is irreversible, and other methods such as pyc, compiling into exe or even modifying the bytecode are easier to restore.

          黄舟

          The most Python can do is obfuscate as mentioned above. If you want to encrypt the data, I haven’t found a good solution yet

            Ty80

            Compile the core code into an os file using cython (note: python syntax is still used).

              左手右手慢动作

              Finally someone has encountered this pitfall, haha

                洪涛

                pyminifier, and then compile it into pyc. Just provide pyc

                  Latest Downloads
                  More>
                  Web Effects
                  Website Source Code
                  Website Materials
                  Front End Template
                  About us Disclaimer Sitemap
                  php.cn:Public welfare online PHP training,Help PHP learners grow quickly!