DesignCAD 3D Max 2027 box
Now available

DesignCAD 2027

Hatches that follow their boundaries, an on-screen dial to turn your model, and a way to find any command by name, in a clean Windows 11 look.

Encryption

Started by SilentType, January 22, 2008, 07:12:34 PM

Previous topic - Next topic

0 Members and 0 Guests are viewing this topic.

SilentType

Hi All,

I've been experiencing ongoing problems from encrypting to the *.bsx format.

Is anyone on the forum very experienced with it? I suspect the problem is linked to using an 'Include' which somehow affects how it unencrypts the two files. I'm not sure that I've been able to get the error to occur in a single file instance, it is far more common in a two file situation.

Basically by adding or subtracting one character (even within a commented out line) can affect whether the macro produces and error or not.

The word 'encrypt' only comes up 5 times between this and the other forum

My question therefore is: Is anyone using the encryption for more than just small file usage?

(I will elabourate on the problem if there seems anyway of addressing it - I imagine the encrypt.exe is now a black box that no-one these days knows how it worked - unless the problem is from how DesignCad uses the unencrypt).

Regards,

ST

aqua

Silent Type

I have used the encrypt.exe file to create bsx files for many years without any issues.

1: Locate encrypt.exe, click on it so it starts.
2: Then click on add files to list and select one of more macros, i.e *.d3m
3: Click open
4: Make sure your output path is correct
5: Then click Encrypt
6: Encrypted macros i.e *.bsx will be created.

You can then supply these macros to some-one else to use via Run Macro
However - they will not be able to see the macro code.

If you are doing something different to the above - you might be on the wrong tram!


You talk about using an 'Include' ??????
How it unencrypts ......?
...the two files ?????
.... in a two file situation????

Yes, Designcad would need to unencrypt the macro so it understood what the original code was.
However - I have never had an issue with a working macro then failing once encrypted.

Maybe check your macro code closely.
Are you trying to encrypt from within the macro code?
As noted above - each macro is just one file - not sure what you mean by two file situation.

Regards Frank


DrollTroll

SilentType,

what are you using for a text editor to create your basiccad macros? PSPad is a very good and friendly editor (and allows you to link to the macros help file).

Are you embedding tabs for formatting, or converting to spaces? If using tabs, I'd recommend trying converting them to spaces.

Also make sure your end-of-line format is Carriage Return/Line Feed. Any other format might confuse the encrypter.

If you're including external files, I'd also recommend embedding them directly into the file you are encrypting -- the Encrypt program predates the ability to include files, so I don't think it will automatically merge them in before encryption.
25 years with DesignCAD

SilentType

Just to clarify I'm running Version 17.2 and been using encrypted files for years. I've been using "included" encrypted files for 15 months. I raised the issue here on the forum back on April 17, 2007, which means I've now had a while to observe behaviour and refine my thoughts on where the problem stems from.

Droll Troll, I use Notepad++ as my text editor. I have tried stripping the tabs, trailing spaces, and have viewed the unencrypted file in a hex-editor to ensure end-of-line format is Carriage Return/Line Feed. I removed all blank lines between the code.

Thanks Aqua, but I'm using encrypt correctly. Let me explain how the multiple file situation occurs. Since as the basicCad Include statement was introduced after the encryption it seems likely the problem is connected to it.

1st file - let's call it "LaunchedMacro.bsx". This is the one that the user selects to run. Can be stored anywhere.
2nd File - let's call it "LinkingMacro.d3m" It's not encrypted. It contains only an Include statement with a file path and file name to the 3rd file. (ie Include "M:\MappedDrive\Functions.bsx"). It is stored in the DesignCad root directory on each users computer - this means each user may have a different pathing to the 3rd file, ie avoids a hardcoded situation)
3rd file - let's call it "Functions.bsx". This file contains all the common / shared subroutines. It is stored on the mapped drive in a specific folder shared by all users. This way I only need to change a section of code once and I've fixed it for all.

So as you can see I can't put all of the code into one .bsx file as I'll end up attempting to maintain code in multiple locations.

In my case, I have in excess of 50 "LaunchedMacro.bsx" macros that "Include" the one "Functions.bsx". When I make changes to "Functions.bsx" I will often get one or two of the 50 macros to fail on load (ie all the others work). Typically with a messages saying "Missing { or }" (which trust me is not missing from the file).

If I add (or remove) one character in the "Functions.bsx" file and re-encrypt (could just add a comment marker ', even white space, or any single character) the behaviour is different. This will result in either all macros working, or a different one or two macros failing on load.

(I've set up another macros that "Calls" each macro in turn - this allows me to quickly identify if all the macros work or not. This is how I've been trying to work through isolating the problem).

So I've basically done enough testing my end to be convinced that the problem lies with the unencryption process, most likely linked to the fact that it's using the include statement.

Given the way that adding or subtracting a single character affects which macros will or won't run, I wonder if there is a link between the combined character length of the two encrypted files. I've had it suggested to me by a consulting programing company that they suspect it's an issue with the "offset". (Unfortunately I'm really not that into programming for that to make any sense to me).

What I don't know is if the problem is more likely to occur with a larger "Functions.bsx" file than a smaller one. What I do know is that the more "launchedMacro.bsx" macros that I have the more likely I am to have a problem in one of the macros (which seems logical enough).

I accept that this issue is something struck only by the way I use the combination of macros, meaning that if I can prove a bug that it will never rise high on a priority list. I'm prepared to do more to isolate the problem, if there is a possibility of a solution being found. Is it possible to pay someone for a solution?

ST

SilentType

Hi All,

Just back to let you all know (well, mainly to let someone in the future who may come across this problem) that I've isolated the problem and have determined a work-around.

Ignore the majority of my previous analysis and consider only this.

"If using an encrypted file to call another encrypted file via the INCLUDE statement the INCLUDE statement must be the very last line of the file".

There must be nothing after it, not even a commented line.

(The help file advises that the Include statement should be after the Main Routine if using the Included file to contain subroutines - I'm encouraging you now to place it on the very last line of your code)

By doing this you will avoid an error that occurs only in approximately 1 in 32 cases, so you may not have much of a problem with it. If you do get the error it can be avoided by changing one character in either the Including or Included file.

The limitations on this work-around are that if you need to INCLUDE more than one file then I expect you'll still experience the intermittant error.

The full details of this have been sent to Droll Troll offline, but as I am apparently the only one encountering this error rectification will (understandably) not be a high priority.

NOTE: These errors will not occur if you are not using encrypted files.