View Full Version : BUG! EncryptScript and OpenEncryptedFile

03 March 2006, 10:18 AM
Arrghh. I've been pulling my hair out all day today about this stupid problem I've been having with my script. I finally nailed it down to the specific problem!

I would give you the example of my script, but a perfect example already exists: a slightly modified excerpt from the MaxScript Reference. Please refer to the "Encrypted Files" section.

Feel free to try this out yourselves:
This is how the encrypted file is generated (from reference)

f = createFile "lock.tmp"
format "%" hardwareLockID to:f
close f
encryptFile "lock.tmp" "lock.dat" 5476557
deleteFile "lock.tmp"

This code is fine, it will make a lock.dat file in your current directory.
Now, we need to 'open' it and read it:

Modified from reference, since it woudlnt work in isolation:

f = openEncryptedFile "lock.dat" 5476557

id = readValue f
close f
if id != hardwareLockID then
format "Lock ID's don't match\n"
--return 0
else ( format "fine...\n")

Save this as a .ms file and run it. Should work fine :)
Now here's the problem:
Encrypt this script with the encryptScript "" function, and try to run it again. This time with the .mse file.

It screws up, after no changes.

03 March 2006, 12:26 PM
i have found the same with some of my own scripts - someone over at the autodesk fourms suggested it was becasue of whitespace (encryption can be funny about it) but im not so sure - i encrypted the file with max 5 - 8 ,only the one encrypted in 8 worked having made no changes



03 March 2006, 11:57 PM
Hmm, well i 'encrypted' it with max 8, so I got the problem. If you tried my example in max8 the same should happen.
..So what am i suppose to do? Guess how the whitespaces should be set out? :banghead::argh:

01 January 2007, 05:29 PM
Hi guys. Any progress with this problem? I'm having the same issues. Also, once you get the encrypted mse file to work, such that it loads the .dat file, is there anything else I need to do to run the contents of the .dat file? or is that already covered in the example script

04 April 2007, 04:15 PM
This encryptScript function is odd and only fairly explained in MAXScripts' documentation.

Any solutions or workarounds available?

04 April 2007, 08:04 PM
just a sidenote... SP1 for Max9 has some changes in the Encryption funtcions...

maybe this targets the problems you have ?

snip from the SP1 readme:


Improved MAXScript encryption so it now uses a much more robust encryption scheme

04 April 2007, 12:42 PM
Yeah, maybe SP1 fixes this issue, but I can't install SP1 on this WS right here, 'cos the german version of MAX9 is installed and SP1's release notes point out that SP1 is supposed to be installed on MAX9 english version :argh:

CGTalk Moderation
04 April 2007, 12:42 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.