I am using micropython to develop a product.
Is there any way to make device read proof ?
Means user can't read code which I have uploaded in esp8266.
Readproof Code
Re: Readproof Code
As a simple measure you can use frozen bytecode, which embeds compiled code into flash. Then there is no python code in the file system except maybe main.py or boot.py. But even the code there can be compiled into flash, or put into _boot.py, which anyhow resides in the flash memory. Still, people could read out the flash and decompile it, but that is some work to do. Except for strings, which can be easily extracted.
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: Readproof Code
There are also obfuscators such as pyminifier. You could presumably freeze obfuscated code to combine both approaches. I perhaps should point out that haven't used the obfuscation feature of pyminifier with MicroPython.
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.
Re: Readproof Code
Compiled bytecode is still stored on an external flash chip, so there is no way to protect it from copying. If ESP8266 can read the contents of this flash chip then so can any other device.
-
- Posts: 61
- Joined: Sun Oct 29, 2017 5:14 pm
Re: Readproof Code
Is there some known way to decompile MicroPython code, or are you just saying that it is theoretically possible?Roberthh wrote: ↑Tue Aug 13, 2019 7:14 pmAs a simple measure you can use frozen bytecode, which embeds compiled code into flash. Then there is no python code in the file system except maybe main.py or boot.py. But even the code there can be compiled into flash, or put into _boot.py, which anyhow resides in the flash memory. Still, people could read out the flash and decompile it, but that is some work to do. Except for strings, which can be easily extracted.
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: Readproof Code
You can read the bytecode (whose functionality is public domain) but there is no decompiler.
My personal view is that obfuscating code is verging on pointless. Give a decent programmer a requirement spec and they will produce something functionally equivalent. It's called clean room programming. The entire IBM PC BIOS was copied that way by various companies. All you're doing by closing source is imposing cost and time constraints on those who would copy your work.
My personal view is that obfuscating code is verging on pointless. Give a decent programmer a requirement spec and they will produce something functionally equivalent. It's called clean room programming. The entire IBM PC BIOS was copied that way by various companies. All you're doing by closing source is imposing cost and time constraints on those who would copy your work.
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.