MAXScript lets you create an encrypted copy of a specified script file with the same name prefix, but with the suffix .mse, in the same directory as the source script file. The encryption uses a fixed hidden key that lets it run on any 3ds Max system, but effectively hides the source of the script. Encrypted script files have the suffix .mse.
To encrypt a script, use the following MAXScript method:
encryptScript <filename_string> [version:<int>]
where <filename_string>
is a string literal or an expression that evaluates to a string specifying the name of the script file whose contents are encrypted.
See File Access Function Search Behavior for a list of directories the filename_string
is searched for if the full path is not specified.
The optional version:
keyword can be either 0 or 1.
When set to 0, the method uses the old encryption scheme of 3ds Max 2 to 9.
When set to 1 or not specified, the method uses the new encryption scheme introduced in 3ds Max 9 SP 1. Note that files encrypted with the new scheme cannot be run in previous versions of 3ds Max. If an encrypted script has to be used in an older version of 3ds Max, use the version:0 option.
EXAMPLE USES ARE
encryptScript "my_script.ms"
--create file compatible with old versions: encryptScript "my_script.ms" version:0
or
scriptfile= "my_script.ms" encryptScript scriptfile
The encrypted script file from the previous examples would be named my_script.mse.
The Run Script button in the MAXScript rollout and the fileIn()
method described in Running Scripts automatically support .mse encrypted scripts.
You can couple this script source code encryption with the hardwareLockID
variable and the encrypted file I/O functions to provide authorization-based protection for your scripts.