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 of strings

  • To: mathgroup at smc.vnet.net
  • Subject: [mg95066] Re: Hash function of strings
  • From: Joseph Gwinn <joegwinn at comcast.net>
  • Date: Mon, 5 Jan 2009 03:27:38 -0500 (EST)
  • References: <gjng6s$2ls$1@smc.vnet.net> <gjqa2r$3aa$1@smc.vnet.net>

In article <gjqa2r$3aa$1 at smc.vnet.net>,
 "Sjoerd C. de Vries" <sjoerd.c.devries at gmail.com> wrote:

> I don't think it's possible. Hash works on Mathematica expressions and
> there is no way that a string expression can be converted to an
> expression consisting of its binary equivalent only. If there would be
> a structure "binary sequence" or so, it must have a Head in
> Mathematica designating it as such and then we're back at something
> like the string problem.
> 
> Cheers --Sjoerd
> 
> On Jan 3, 12:55 pm, Nacho <ncc1701... at gmail.com> wrote:
> > Hello all.
> >
> > I'm trying to calculate the MD5 Hash function of a series of strings
> > and I'm getting different results from the "true" MD5.
> >
> > I have searched the group and I have found that the Hash[] function is
> > including the " " of the strings. A solution is proposed, creating a
> > temporary file and then using FileHash.
> >
> > My problem is that I want to calculate the Hash of about one million
> > strings, so creating temporary files is impossible.
> >
> > Can you think in a method to calculate the Hash very quickly, without
> > the " "?
> >
> > Thanks a lot.

A million hashes?  Performance will also be an issue.

Use MathLink to access one of the standard C-coded MD5 functions via 
some C glue code that will strip the quotes, et al.

Joe Gwinn


  • Prev by Date: Re: Graph of some built-in functions blows up Mathematica V7
  • Next by Date: Re: Re: Locators with complete graph, Kn
  • Previous by thread: Re: Changing default meaning of ImageSize -> Automatic
  • Next by thread: Re: Module and call or others