Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Hash function

  • To: mathgroup at smc.vnet.net
  • Subject: [mg97550] Re: Hash function
  • From: "Sjoerd C. de Vries" <sjoerd.c.devries at gmail.com>
  • Date: Sat, 14 Mar 2009 18:19:02 -0500 (EST)
  • References: <gpg1ju$co0$1@smc.vnet.net>

Hash does a hash on the expression that is its argument, in this case
the file name (which is different for both locations if you include
the path). You need FileHash, which does a hash on the file itself.

Cheers -- Sjoerd

On Mar 14, 12:41 pm, 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];
> ]



  • Prev by Date: Re: Two Notebooks Open at the Same Time
  • Next by Date: inverse of calculation
  • Previous by thread: Hash function
  • Next by thread: Re: Hash function