hash() function - 2022/11/12 - beta.15

Post your working scripts, libraries and tools.
User avatar
jNizM
Posts: 3183
Joined: 30 Sep 2013, 01:33
Contact:

Re: hash() function - 2022/01/28 - beta.3

Post by jNizM » 01 Feb 2022, 05:21

Try this: viewtopic.php?f=83&t=96117
till I found his mistake ;)
[AHK] v2.0.5 | [WIN] 11 Pro (Version 22H2) | [GitHub] Profile
User avatar
TheArkive
Posts: 1030
Joined: 05 Aug 2016, 08:06
Location: The Construct
Contact:

Re: hash() function - 2022/01/28 - beta.3

Post by TheArkive » 01 Feb 2022, 05:23

Probably utf16 vs utf8
User avatar
jNizM
Posts: 3183
Joined: 30 Sep 2013, 01:33
Contact:

Re: hash() function - 2022/01/28 - beta.3

Post by jNizM » 01 Feb 2022, 05:25

Change LBuf.size to LBuf.size - 1 and use the right encoding (UTF-8)

And the 4GB limit is because the function reads the complete file into memory.
For larger files the function should be changed to (like) this: https://github.com/jNizM/AHK_CNG/blob/master/src/Class_CNG.ahk#L380-L394
[AHK] v2.0.5 | [WIN] 11 Pro (Version 22H2) | [GitHub] Profile
User avatar
TheArkive
Posts: 1030
Joined: 05 Aug 2016, 08:06
Location: The Construct
Contact:

Re: hash() function - 2022/01/28 - beta.3

Post by TheArkive » 01 Feb 2022, 05:53

Cool thanks. I'll make those changes.

It would be LBuf.size - 2 for utf16 right?
User avatar
TheArkive
Posts: 1030
Joined: 05 Aug 2016, 08:06
Location: The Construct
Contact:

Re: hash() function - 2022/02/02 - beta.3

Post by TheArkive » 01 Feb 2022, 18:34

2022/02/02
  • chanaged parameters, added chunk size and callback
  • updated example
  • file is now read per c_size in order to support files over 4GB
  • use callback to monitor progress, callback accepts one param (float)
  • now only UTF-8 is used to hash text
  • input item must be VarRef now
  • updated readme
Thanks @jNizM for the suggestions.
midodds
Posts: 1
Joined: 09 Apr 2016, 09:27

Re: hash() function - 2022/02/02 - beta.3

Post by midodds » 01 Jun 2022, 04:15

Hi

Hoping you will be able to help with this error. The error only occurs when running as an exe not as a script

I call the CNG function from the script like this ....... if (Hash.String("SHA1", Password) =

The CNG cript has been added to the end of my script and starts from "class Hash extends CNG"

Mike
Attachments
Screenshot 2022-06-01 101136.jpg
Screenshot 2022-06-01 101136.jpg (15.03 KiB) Viewed 714 times
User avatar
TheArkive
Posts: 1030
Joined: 05 Aug 2016, 08:06
Location: The Construct
Contact:

Re: hash() function - 2022/02/02 - beta.3

Post by TheArkive » 01 Jun 2022, 04:59

You use this func and the CNG class from jNizM? I don't recommend that. You don't need the hash() func if you use the CNG lib.

Edit: it looks like you might be mixing versions too. Are you using AHK v1 or v2?
Post Reply

Return to “Scripts and Functions (v2)”