Creates a password protected pcode version of an M-file. The user of the pcode file will have to enter the password only on the first execution of the code per session, or until a 'clear all' command is issued. Will not alter the input M-file. Please see the rather verbose help for more information and a built in example.
Please contact me for bug fixes and/or suggestions. My email is in the file. Thanks.
While I still appreciate the quality of the code, I do think that the achieved protection level is not high enough for a function called "pass_protect".
It will need less than a minute to circumvent the P-coded password check.
Good idea, very good documentation, smart example.
A bug: The example fails since Matlab 2008b (or earlier?), because the line breaks of M-files are char(10) now, but pass_protect assumes [13, 10]. Solution: Swap "13" and "10" in the lines 128 and 129, than this works on Windows and Linux formated files.
But there is a remarkable problem: The password is saved as clear text in the file and I need less than a minute to extract it. Without substantial improvements the level of protection is low.
Good idea, Daniel. I am going overseas for a week, so if I don't get to it before I go, I will look into it when I get back. As it is now, the person who generates the password protected pcode can open and inspect the M-file, then delete everything after the help very easily. That will give them the help file to accompany the pcode file. Thanks.
Well done. One suggestion I would make is this: Why not just return the "intermediate M-file" but with only the help section intact? That way the person who encodes a file could distribute the password protected version (pcode) with a help file included for the end user. Just a suggestion, other than that I like the file.