AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

cant add serveral md5-Sums together

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
aaffe



Joined: 17 May 2007
Posts: 66

PostPosted: Fri Dec 21, 2007 3:22 pm    Post subject: cant add serveral md5-Sums together Reply with quote

Hallo,
Iīve got a big problem.
I wrote a program which takes a md5sum for each file on a CD.
These md5sums then are written to a file, this file looks like this:

406AF00DB376F945738C5670DA9832A0 F:\abda_version.txt
5F10FBBD22281B20B45A216895D90B06 F:\AplusV_Stand.txt
49E99886FAF611523EB0219F76E17A23 F:\Batch_Taxe.Z
D66274C7BD78FD6C8DC9C973280EBB85 F:\Data_Abda.z
58498A720B3AF79F62EDBEA6203AC5BB F:\Data_AplusV.z
07C64D061FC858A4634B5A32B05A0DF6 F:\Data_Install.z
26533E6D28EDC8DB1276C6577A1E067E F:\Data_Rezeptur.z
4BA6232DA660292F156DCB1163AA5F03 F:\Data_Synopsis.z
B13CB6D870FAF40A8EDDCF0A7BA86797 F:\Data_Taxe.Z
98A31A5FEF066085E66A3F017898FB8C F:\DISK1.ID
D11063290FEDB7C472AD8392F34D4275 F:\InstallInfoControl.exe
AF27400C04853A40206E5E5F8606F39E F:\isdbgn.dll
E9F68CE4BFD941CF0D28012622BA3B85 F:\Rezeptur_Stand.txt
AD134125AF23B1405F153AE5F788DC42 F:\setup.dbg
E6799BDE5DBD22A1E240EAE3F0F3397F F:\SETUP.EXE
8C9169EF881390B26D52CD7E57431021 F:\setup.ins
36FC71F6AA982C740C06264FCB19E199 F:\setup.pkg
B412106A92981D896643B2F8B5073B2A F:\setup.rul
41F053D466CEA50ECB0ED994AD15C081 F:\UpdateCDValidity.txt
9294EC2B510F469EF95242275DBC5AD0 F:\_INST32I.EX_
C3200E3277AEF0E5D150D797AA62D55F F:\_ISDEL.EXE
1E4F8E41182F98496CCBA5EF0DD70803 F:\_SETUP.DLL
F30A7FB41C0188BFD1D94DD8AEF4C21A F:\_SETUP.LIB

After that I read each line of the File and split this line, so that Iīve got a variable sum just with the md5sum in it, without the name of the file.
Like this:
sum1=406AF00DB376F945738C5670DA9832A0
sum2=5F10FBBD22281B20B45A216895D90B06
and so on...

After that I wanted to add all these md5sums together. But because there werenīt only numbers, I tought I had to convert my sum-varialbes first to hex:

Quote:

SetFormat,integer,hex
sum1:="0x" . sum1 + 0
sum2:="0x" . sum2 + 0

But when I then tried to add sum1 and sum2, this didīnt calculate the right value.
The answer to sum1 + sum2 was really something like "-2".

Then I thought, perhaps I have to use VarSetCapacity, but all I tried didnīt calculate right.

Can please someone tell me how to add several md5sums and when to use VArSetCapacity? Thanks a lot!
Back to top
View user's profile Send private message
tic



Joined: 22 Apr 2007
Posts: 1353

PostPosted: Fri Dec 21, 2007 6:19 pm    Post subject: Reply with quote

why would you want to add the md5 sums together?

I doubt you could add such massive numbers together anyway. do you realise how big those numbers are?
Back to top
View user's profile Send private message
Guest






PostPosted: Fri Dec 21, 2007 6:29 pm    Post subject: Reply with quote

Quote:
from help file
Commands, functions, and expressions that accept numeric inputs generally support 15 digits of precision for floating point values. For integers, 64-bit signed values are supported, which range from -9223372036854775808 (-0x8000000000000000) to 9223372036854775807 (0x7FFFFFFFFFFFFFFF). Any integer constants outside this range are not supported and might yield inconsistent results. By contrast, arithmetic operations on integers wrap around upon overflow (e.g. 0x7FFFFFFFFFFFFFFF + 1 = -0x8000000000000000).
Back to top
aaffe



Joined: 17 May 2007
Posts: 66

PostPosted: Thu Dec 27, 2007 2:01 pm    Post subject: Reply with quote

Hallo,
I want to add these md5-sums, because I want to get only one sum for noe whole CD.
so I want to check several copied CDs if their content is really the same as the origin.
because of this I want to make a checksum from all files on the CD, after this I want to add these checksums togetcher so that I can write this last, added checksum on the CD .
THE Woman to whom I send the CD has the same program as mine and she can check if she gets the same checksum as my one was. When they are the same, everything was ok. If not, perhapts there was a failure and we have to check.
.....
Back to top
View user's profile Send private message
SKAN



Joined: 26 Dec 2005
Posts: 5884

PostPosted: Thu Dec 27, 2007 2:56 pm    Post subject: Re: cant add serveral md5-Sums together Reply with quote

aaffe wrote:
These md5sums then are written to a file


Just hash the resultant file. That would be sufficient. Smile
Back to top
View user's profile Send private message
DerRaphael



Joined: 23 Nov 2007
Posts: 456
Location: Heidelberg, Germany

PostPosted: Thu Dec 27, 2007 2:59 pm    Post subject: Reply with quote

why dont you make a checksum for the file containing all the other checksums? this way u'd generate md5hashes for each file and after storing these into file or variable have a checksum for this one knowing the last checksum, you can be sure your cd content is correct. either my solution is too simple or i didnt understood your request...

greets
derRaphael
_________________
Back to top
View user's profile Send private message
tonne



Joined: 06 Jun 2006
Posts: 1159
Location: Denmark

PostPosted: Thu Dec 27, 2007 3:55 pm    Post subject: Reply with quote

If you can't live without this (ugly) function sum up to hex numbers:
Code:
msgbox % hexadd("406AF00DB376F945738C5670DA9832A0","5F10FBBD22281B20B45A216895D90B06")

hexadd(a,b)
{
  result =
  addend = 0x00
; adjust to same length 
  la := strlen(a)
  lb := strlen(b)
  loop % lb-la
  {
    a = 0%a%
    la++
  }
  loop % la-lb
  {
    b = 0%b%
    lb++
  }
; add from end 
  SetFormat,Integer,Hex
  loop %lb%
  {
    da := "0x" . SubStr(a,la,1)
    db := "0x" . SubStr(b,la,1)
    r  := da+db+addend
    result := SubStr(Mod(r,0x10),3) . result
    addend := r//0x10
    la--
  }
  if (addend > 0x00)
    result := SubStr(addend,3) . result
  return %result%
}

_________________
there's a dog barking close within the range of my ear
sounds like he wants to escape the chain
he would probably bite me to death if he could
but the chain lets me spit in his face

- Kashmir
Back to top
View user's profile Send private message
aaffe



Joined: 17 May 2007
Posts: 66

PostPosted: Thu Dec 27, 2007 4:39 pm    Post subject: Reply with quote

Hallo,
thanks to all of you. the way just to make a checksum for the file with all the checksums in it is a very easy way.
Now I did it like this. Thanks!
And thanks to tonne now to know how to add hex numbers.
Greets, aaffe
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group