Jump to content

Autoit Math Corrupting Data


Recommended Posts

Well I am writing a little encryption algorithm, and I have come across the problem that the decryption fails and kills the process about 1 out of every 5 times.

I have found this is because of the way autoit handles numbers. It causes the decrypted string to not be the ssame, and returns junk data.

I have already been recommended the bignum math UDF, but it makes my script run 1000x slower (no exaggeration here).

Is there any way to work with the WHOLE full numbers? (or any way to do it, I do not know much about using dlls, but maybe it would be possible to pass two matrices to the dll, and have it multiply them and return the result? idk if dllcall supports arrays)

Here is my code so far

* removed on request of the OP *

Edited by Jos
Link to comment
Share on other sites

You already have a open for this script, or something very similar to it, so why open another?

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

  • Moderators

nullschritt,

I count at least 3 threads with another couple looking very related. Please do not start any more. :naughty:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

nullschritt,

I count at least 3 threads with another couple looking very related. Please do not start any more. :naughty:

M23

There is admittedly (only one) other thread on this subject, that I made, and yes there are others related to this same code, but they are for other issues with it, not all for the problem with numbers and math.

You already have a open for this script, or something very similar to it, so why open another?

Because the title of the other is about another issue, just in the same project. Edited by nullschritt
Link to comment
Share on other sites

  • Moderators

Why not stick to one thread, involving all your issues with the one project, so there is continuity? Make it easy for forum members to help you :)

Edited by JLogan3o13

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Why not stick to one thread, involving all your issues with the one project, so there is continuity? Make it easy for forum members to help you :)

I suppose I could do that, but now this one is already open, soo, :oops:

But these posts about my threads have become unnecessarily redundant as well :guitar:

Any Ideas? :idea:

Link to comment
Share on other sites

  • Moderators

nullschritt,

But these posts about my threads have become unnecessarily redundant as well

Any Ideas?

Yes - but I am not going to give in to the temptation. ;)

Just do not open any more, OK? :D

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

nullschritt,

Yes - but I am not going to give in to the temptation. ;)

Just do not open any more, OK? :D

M23

Yeah, like anyone is going to help me on this subject.

Please tell me I'm the only one who gets next to zero help on the tasks I actually NEED help on.

It seems that all this section is here to do, is to have people answer questions that can be answered with the help file, and when it can't people just ignore it.

And I know it's not like there isn't anyone intelligent enough to help or at least offer on topic advice.

Edited by nullschritt
Link to comment
Share on other sites

Unfortunately you're not going to get too much help because there are parts of the script missing, unless we can actually run the script there's little point in troubleshooting it because we can't be sure it's going to work with anything we suggest.

BTW, the attitude isn't going to help either.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

  • Moderators

nullschritt,

Please tell me I'm the only one who gets next to zero help on the tasks I actually NEED help on

And what if no-one actually knows the answer? :huh:

I remember my first few posts here remaining unanswered - I did not throw my toys out of the cot as it was obvious to me that those who could not help were not going to post saying so, and several score of "Sorry" posts does not help either. You need to remember this is not a 24/7 support forum - those who answer are only here because they like helping others and have some time to spare. If their interests and yours do not coincide then you are out of luck - and no worse off than if you had never asked. ;)

So I suggest that you lose the hang-dog attitude and try to act in a more sensible manner as your current one is not helping you at all. :)

M23

P.S. Encryption algorithms are very difficult to write in any language, but in my opinion AutoIt is not at all suited to this task given its (lack of) speed. Why not use the Crypt UDF which allow you to encrypt/decrypt easily without the complexity? :)

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

nullschritt,

And what if no-one actually knows the answer? :huh:

I remember my first few posts here remaining unanswered - I did not throw my toys out of the cot as it was obvious to me that those who could not help were not going to post saying so, and several score of "Sorry" posts does not help either. You need to remember this is not a 24/7 support forum - those who answer are only here because they like helping others and have some time to spare. If their interests and yours do not coincide then you are out of luck - and no worse off than if you had never asked. ;)

So I suggest that you lose the hang-dog attitude and try to act in a more sensible manner as your current one is not helping you at all. :)

M23

P.S. Encryption algorithms are very difficult to write in any language, but in my opinion AutoIt is not at all suited to this task given its (lack of) speed. Why not use the Crypt UDF which allow you to encrypt/decrypt easily without the complexity? :)

And as for no one else knowing the answer? I doubt that seriously, I know there are plenty of people here more intelligent than myself. I would be arrogant to assume that a problem too complex for me to figure out, would be too complicated for other more experienced users to know the answer to.

I feel like 90% of the questions in is section are just people being lazy and not getting off their arses and looking in the help file themselves, and then when "actual" problems arise, help is scarce or non-existent, and such threads get buried very quickly by the barrage of "y i no can do a hash" and "how to pixelsearch", topics.

Speed is not a concern, it fast ENOUGH for practical use (10ms to encrypt 20ms to decrypt), the problem is autoit being mathematically innacurate, which is why I didn't provide my full code for debugging, because the problem has nothing to do with my code specifically, but math with autoit in general.

None the less, here is the full project (created with ISN Studio

*removed on request of OP *

Edited by Jos
Link to comment
Share on other sites

  • Moderators

And as for no one else knowing the answer? I doubt that seriously, I know there are plenty of people here more intelligent than myself. I would be arrogant to assume that a problem too complex for me to figure out, would be too complicated for other more experienced users to know the answer to.

Couldn't agree with you more. This fact, then, leaves only your demeanor as the reason you're not receiving help. :) All you have done thus far is complain at not getting help fast enough, first by creating multiple threads, and then through thinly-veiled insults. Why do you believe this is going to cause forum members to rush to your aid?

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Couldn't agree with you more. This fact, then, leaves only your demeanor as the reason you're not receiving help. :) All you have done thus far is complain at not getting help fast enough, first by creating multiple threads, and then through thinly-veiled insults. Why do you believe this is going to cause forum members to rush to your aid?

My slightly irritated "demeanor" didn't arise until my requests for help were ignore. I am aware I cannot demand help, but if I am not getting it anyways, then I didn't see much harm in expressing my irritation with the situation.

Edit:

I did not complain at all actually, until just earlier today, which then even I don't think I "complained", I was expressing a matter of fact(with a slight undertone of irritation), that no one was helping me, and that the chances of receiving help were growing slimmer, next to nothing, as the thread was being buried, and you cannot tell me that anyone is going to he me when my question is 3 or 4 pages in to the help section, with no responses, or no useful responses(by useful I am simply talking about solution wise)

Edited by nullschritt
Link to comment
Share on other sites

nice productive thread...

shall we put out the candle before it falls off the mantle and burn 1/10 of California down?

@OP please edit the OP and re-paste your code (with its proper indents). I took one look at it and turned away.

I know it's not your fault, it's the forum's edit function being 1337 and sniping your code when you edit and save.

Spoiler

“Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”

 

Link to comment
Share on other sites

  • Moderators

nullscritt,

My slightly irritated "demeanor" didn't arise until my requests for help were ignore

As I have already pointed out, you have no right to expect an answer. But other members have a perfect right to "ignore" your thread if they so wish. But I do not believe that this would happen if someone could genuinely help - unless they were dissuaded by your rather petulant behaviour. ;)

As to threads being buried, there is no prohibition on you bumping your own thread after a reasonable period (say 24hrs) and doing so a few times before giving up. What you should not do is start multiple threads and then throw a hissy fit because you do not get an answer. :naughty:

Anyway enough of this - it seems obvious to me that either no-one knows a solution to your problem, or if they do they are not prepared to help you (and you might be able to guess why after the last few posts ;)).

M23

Edit: It seems that you have an offer - might be a good idea to take it up quickly! :D

Edited by Melba23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Edit: It seems that you have an offer - might be a good idea to take it up quickly! :D

meh... I just don't like looking at unformatted lines of code. I'm in front of a computer 14-16 hours a day... Gunnars only do so much for my eyes :shocked:

And I'm sure others pass up helping people because of not being able to read their code efficiently either.

Edited by mechaflash213
Spoiler

“Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”

 

Link to comment
Share on other sites

Well, I ran the full script and it worked fine, until it crashed AutoIt that is, it encrypted and decrypted the test text for me. There's something in your decrypt function that is causing a hard error in AutoIt, not sure what but it only happens when the _decrypt function is called.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

  • Moderators

mechaflash213,

And I'm sure others pass up helping people because of not being able to read their code efficiently either

Very sage advice to anyone reading! :thumbsup:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Well, I ran the full script and it worked fine, until it crashed AutoIt that is, it encrypted and decrypted the test text for me. There's something in your decrypt function that is causing a hard error in AutoIt, not sure what but it only happens when the _decrypt function is called.

I know what t is, and I have said it in the very first post. It is autoit messing up the math and not returning the right results, the numbers get too big and then can't be returned to their original value because of how autoit doesnt support "big numbers", then it gets junk data, and when it runs that through the decompress function, the script crashes.

for $i=1 to 5
$enc = _mMul($enc,$keys[$ran[$i+1]])
;then here we run the encrypted text (with the randomized key) through 13 more levels or random encryption
Next

[.....]

for $i=0 to $keysx[0] - 3
$string = _mMul($string, _inv($keys[$keysx[$keysx[0]-$i]]))
Next

This is why originally I tried the bignum math udf, but it was so incredibly slow that it was completely impractical.

nice productive thread...

shall we put out the candle before it falls off the mantle and burn 1/10 of California down?

@OP please edit the OP and re-paste your code (with its proper indents). I took one look at it and turned away.

I know it's not your fault, it's the forum's edit function being 1337 and sniping your code when you edit and save.

I did so, as well as linked to the full project with all the script files. Edited by nullschritt
Link to comment
Share on other sites

I want to but in here, nullschritt you say that AutoIt is inaccurate with maths. This is something that most of us know and sometimes can be solved with various methods. There are several reasons why numeric expressions might return approximate, rather than exact, results. This is universal in all programming languages and not only a problem with AutoIt. The bignum UDF clearly has found a way around some of these limitations. The 15 digit accuracy did not affect the massive numbers we were able to work with in the previous thread.

I don't get involved in all this emotional stuff if I can avoid the temptation. Let's see if we can figure out what the problem might be here. As regards helping, it is a fact that many here love to demonstrate their skills as programmers by finding elegant solutions to problems. This gives both a sense of acheivement and a certain amount of personal credit.

Your thread title and question only requires a very simple demonstration of where the maths isn't working accurately. Just a mathematical sum would be enough to demonstrate this problem. That is easier to answer than code which is confusing or does not contain all the information, which was the case with the previous thread, at first.

Edited by czardas
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...