File Exchange

image thumbnail

pass_protect

version 1.0.0.0 (4.31 KB) by Login_Name
Creates a password protected pcode version of an M-file.

1 Download

Updated 02 Nov 2007

View License

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.

Comments and Ratings (5)

Jan

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.

Jan

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.

Zhijun Wang

Good Work!

Matt Fig

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.

Daniel Laug

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.

MATLAB Release Compatibility
Created with R2006a
Compatible with any release
Platform Compatibility
Windows macOS Linux