Re: Hash function
- To: mathgroup at smc.vnet.net
- Subject: [mg97554] Re: Hash function
- From: Raffy <raffy at mac.com>
- Date: Sun, 15 Mar 2009 05:27:30 -0500 (EST)
- References: <gpg1ju$co0$1@smc.vnet.net>
On Mar 14, 3:41 am, Ignacio Plazeta <Ignacio.Plaz... at speednet.es>
wrote:
> Dear Friends
>
> I bet I'm wrong in a childish way but I'm
> incapable to overcome the bug.
>
> Why does the following code return discrepant values
> when processing two identical file ( CRTL + C , CRTL + V )
> placed in two different folders ? Of course, I'm looking on only
> the Hash part of the out, being obviously the folder related part.
>
> Warmest regards.
> Ignacio
>
> fileIdentifier[myFile_]:=Module[{ tmp , folderPos },
> folderPos = StringPosition[myFile,"\\"]//Flatten//Max;
> tmp={
> FileByteCount[myFile],
> Hash[myFile,"SHA512"],
> StringJoin[
> (If[#>10,ToString[#],"0"<>ToString[#]])&/@FileDate[myFile]
> ],
> StringTake[myFile,folderPos-1],
> StringDrop[myFile,folderPos]
> };
> Return[tmp];
> ]
FileHash?