← Back to team overview

dolfin team mailing list archive

Re: Dependence on OpenSSL

 

On Tue, Oct 06, 2009 at 02:28:40PM -0500, Andy Ray Terrel wrote:
> Sorry for being dense but computing the SHA1 hash for what essentially
> is a string compare seems a bit overkill.

I want to avoid a call to strcmp in a piece of code that needs to be
fast. What I do (it seems to work now) is to compute the 20 byte SHA-1
hash from the ~40 byte finite element signature which is typically
something like

  FiniteElement('Lagrange', 'triangle', 1)

I then cast the SHA-1 hash to an 8 byte void* and use that for
comparison. This may not be very safe but this is not exactly
cryptography. The number of possible hashes is the same as the address
space so it should be fine.

--
Anders


> On Tue, Oct 6, 2009 at 2:18 PM, Anders Logg <logg@xxxxxxxxx> wrote:
> > I'm contemplating adding a dependency to OpenSSL for computing hashes
> > of things like element signatures.
> >
> > This is what breaks Kristian's code. Comparing element pointers does
> > not work since the UFC class creates its own elements which are
> > different from the ones existing in FunctionSpace classes.
> >
> > Would there be any difficulties with depending on OpenSSL? Are there
> > simpler alternatives for a function that takes a string a returns a
> > message digest like the SHA1 function in OpenSSL?
> >
> >
> > -----BEGIN PGP SIGNATURE-----
> > Version: GnuPG v1.4.9 (GNU/Linux)
> >
> > iEYEARECAAYFAkrLmCAACgkQTuwUCDsYZdEk3ACgl7+tHjclHzLesh+g/1vOzIo9
> > tJsAn1fHGu+dzyA/ndNpy88/RFWNTbEB
> > =24AA
> > -----END PGP SIGNATURE-----
> >
> > _______________________________________________
> > DOLFIN-dev mailing list
> > DOLFIN-dev@xxxxxxxxxx
> > http://www.fenics.org/mailman/listinfo/dolfin-dev
> >
> >
> _______________________________________________
> DOLFIN-dev mailing list
> DOLFIN-dev@xxxxxxxxxx
> http://www.fenics.org/mailman/listinfo/dolfin-dev

Attachment: signature.asc
Description: Digital signature


Follow ups

References