| View previous topic :: View next topic |
| Author |
Message |
bahri
Joined: 24 Jun 2004 Posts: 104 Location: Malta
|
Posted: Tue Mar 01, 2005 11:41 am Post subject: checksum |
|
|
Hi all!
How about a variable that captures the checksum of a file, may be md5.
This is great for comparing files for changes in a definitive way.
Can be used as a file backup check etc.
OK can be done with dates and times but an md5 sum is much more definative.
There's command-line utils that can do this but I like to stay within ahk as much as possible.
Thanks |
|
| Back to top |
|
 |
BoBo Guest
|
Posted: Tue Mar 01, 2005 12:06 pm Post subject: |
|
|
Why sould I be interested to download/keep unnecessary code/features which attracts a minority of people, while it needs only a single line of code within my script like ...
| Code: | | Run, dsmd5 inputfile |
... to accomplish that task ?
FYI:
dscrc = 5 Kb
dsmd5 = 6Kb
dsshc = 7Kb |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10480
|
Posted: Tue Mar 01, 2005 12:26 pm Post subject: |
|
|
Although a checksum command might be added someday, for now I agree that it's a little too far outside the central mission of AutoHotkey. I also feel the same way about a built-in encrypt command.
However, if the md5 checksum or some good CRC method is a very short block of code, I would reconsider. Small easy things, such as SoundBeep, get a higher priority. |
|
| Back to top |
|
 |
bahri
Joined: 24 Jun 2004 Posts: 104 Location: Malta
|
Posted: Tue Mar 01, 2005 12:30 pm Post subject: |
|
|
| If you're not interested, just don't use the feature. |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10480
|
Posted: Tue Mar 01, 2005 12:32 pm Post subject: |
|
|
I should clarify that code size is a consideration because it affects the size of all compiled scripts, as well as the amount of resources that every script uses. So the decision on whether to add a new feature is based on:
1) What percentage of users would use it.
2) How big a benefit is it.
3) How large is the code and how difficult is it to integrate.
In this case, MD5 appears to score low in all three. However, I'm always open to contrary opinons, or even a poll to vote on which features should be included and which things not. |
|
| Back to top |
|
 |
bahri
Joined: 24 Jun 2004 Posts: 104 Location: Malta
|
Posted: Tue Mar 01, 2005 12:53 pm Post subject: |
|
|
Chris, You're right and I appreciate all the work you put in AHK.
Thanks for a great program. |
|
| Back to top |
|
 |
niwi
Joined: 27 Feb 2005 Posts: 128 Location: Heidelberg, Germany
|
Posted: Wed Mar 02, 2005 5:37 pm Post subject: |
|
|
Hi,
maybe someone knows a good and small checksum algorithm and may write an AHK script so it may be possible to build a function library. If someone needs a checksum he / she may just include the code of this library.
Regards, NiWi. |
|
| Back to top |
|
 |
BoBo Guest
|
Posted: Thu Mar 03, 2005 8:25 am Post subject: |
|
|
Just in case someone doesn't know anything about it ...
 |
|
| Back to top |
|
 |
niwi
Joined: 27 Feb 2005 Posts: 128 Location: Heidelberg, Germany
|
Posted: Thu Mar 03, 2005 5:53 pm Post subject: |
|
|
Hi BoBo,
ok, MD5 is neither a checksum nor an encryption. But it could be used as an checksum algorythm because it generates a 128 bit long term depending on the source and detecting changes like capital letters or different positions of a character in the input string.
But if Bahri have a need for this, it should not be a problem to create an AHK script and use the #include command to load this.
BTW: AHK is not able to use custom functions with parameters yet. Is there a styleguide for building variables and use gosub? I think about setting the vars first, which may start with defined characters such as double underscores:
#include functionlib.ahk
__myfirstparam = Hello
__mysecondparam = world.
gosub, f_testfunction
returnvlaue = __myreturn
It is not really pretty, but it should work.
Regards, NiWi. |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10480
|
Posted: Thu Mar 03, 2005 6:14 pm Post subject: |
|
|
| niwi wrote: | | Is there a styleguide for building variables and use gosub? | There is a short one on the Variables page:
http://www.autohotkey.com/docs/Variables.htm (as "Naming Variables to Improve Maintainability")
As as you pointed out, the ability to pass parameters and receive return values from subroutines is planned for the near future. |
|
| Back to top |
|
 |
|