[freenet-dev] [freenet-cvs] r18968 -?trunk/freenet/src/freenet/crypt

Florent Daignière nextgens at freenetproject.org
Sat Apr 5 11:48:01 UTC 2008


* Matthew Toseland <toad at amphibian.dyndns.org> [2008-04-05 11:28:41]:

> On Saturday 05 April 2008 04:13, Florent Daignière wrote:
> > * Matthew Toseland <toad at amphibian.dyndns.org> [2008-04-04 19:12:05]:
> > 
> > > On Friday 04 April 2008 06:25, you wrote:
> > > > Author: nextgens
> > > > Date: 2008-04-04 05:25:41 +0000 (Fri, 04 Apr 2008)
> > > > New Revision: 18968
> > > > 
> > > > Modified:
> > > >    trunk/freenet/src/freenet/crypt/DSAPublicKey.java
> > > > Log:
> > > > implement DSAPublicKey.hashCode()
> > > > 
> > > > Modified: trunk/freenet/src/freenet/crypt/DSAPublicKey.java
> > > > ===================================================================
> > > > --- trunk/freenet/src/freenet/crypt/DSAPublicKey.java	2008-04-04 
> 05:21:19 
> > > UTC (rev 18967)
> > > > +++ trunk/freenet/src/freenet/crypt/DSAPublicKey.java	2008-04-04 
> 05:25:41 
> > > UTC (rev 18968)
> > > > @@ -163,6 +163,13 @@
> > > >  		return y.equals(o.y) && group.equals(o.group);
> > > >  	}
> > > >  
> > > > +	public int hashCode() {
> > > > +		int hash = 5;
> > > > +		hash = 61 * hash + (this.y != null ? this.y.hashCode() : 0);
> > > > +		hash = 61 * hash + (this.group != null ? this.group.hashCode() : 0);
> > > > +		return hash;
> > > > +	}
> > > 
> > > Arcane maths should really be justified in comments!
> > 
> > It's a standard pattern
> 
> Does it provide equal influence for y and group on the first few bits of the 
> hash code? Since I am not familiar with this particular pattern, it's your 
> job to justify it!

No it's not equal in terms of influence and that's on purpose.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://emu.freenetproject.org/pipermail/devl/attachments/20080405/0b92b8b9/attachment.pgp 


More information about the Devl mailing list