[Glass] Hash implementations

Trussardi Dario Romano via Glass glass at lists.gemtalksystems.com
Thu Mar 15 03:28:40 PDT 2018


Ciao,

	i have a seaside application development with Pharo ( 4.0 ) and deployment with Gemstone GLASS.

	Now  i have some doubts about collisions regarding the hashing and the equality implementation.

	Where for collision i intend the same hashing value from two different object.


	For example i have a class where redefine the methods : 		=  	and	the relative 	hash .

	= anItem

	anItem ifNil:[^false]. 
	
	anItem class = self class ifFalse:[ ^false].

	^  rfrConsegna  = anItem rfrConsegna 
				and:[ rfrSubTable  = anItem rfrSubTable
							and:[ referenceTime = anItem referenceTime 
								and:[ consumer = anItem consumer
									and:[ item = anItem item
										and:[ opzioniVoce  = anItem opzioniVoce ]]]]]
	
	

	hash
	
	^ self class hash
		 bitXor:( 	rfrConsegna hash 
				bitXor:( rfrSubTable  hash
					bitXor: ( referenceTime hash
						bitXor: ( consumer   hash
							bitXor: ( item   hash
								bitXor: ( opzioniVoce  hash ))))))


		( All variables used define the respective methods:   	=    hash )

	Now all works fine, 
	
	but i can have collision ?

	From the theoretical point of view it is right ?

	Someone can give me indications about it?

	Thanks for any considerations.

		Dario
				
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gemtalksystems.com/mailman/private/glass/attachments/20180315/fda6023a/attachment.html>


More information about the Glass mailing list