--- a/UUID.st Wed Feb 24 11:09:08 2010 +0100
+++ b/UUID.st Fri Mar 05 15:57:14 2010 +0100
@@ -576,6 +576,29 @@
"
! !
+!UUID methodsFor:'hashing'!
+
+hash
+ "Generate a 30 bit hash value.
+ For Timestamp-UUIDs:
+ Bytes 1,2,3,4 are the least significant bits of the timestamp,
+ Bytes 14,15,16 are the least significant bytes of the mac address -
+ but considering these bytes does not generate a better hash to
+ justify the additional computations.
+
+ For random UUIDs, every byte is random anyway."
+
+ ^ (((((((self basicAt:2) "bitXor:(self basicAt:14)") bitShift:8)
+ + ((self basicAt:3) "bitXor:(self basicAt:15)")) bitShift:8)
+ + ((self basicAt:4) "bitXor:(self basicAt:16)")) bitShift:6) bitXor:(self basicAt:1)
+
+ "
+ |allHashes|
+ allHashes := UUID allInstances collect:[:each| each hash].
+ (allHashes asSet size / allHashes size) asFloat
+ "
+! !
+
!UUID methodsFor:'printing'!
displayString
@@ -656,7 +679,11 @@
!UUID class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic2/UUID.st,v 1.30 2009-06-15 12:43:41 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic2/UUID.st,v 1.31 2010-03-05 14:57:14 stefan Exp $'
+!
+
+version_CVS
+ ^ '$Header: /cvs/stx/stx/libbasic2/UUID.st,v 1.31 2010-03-05 14:57:14 stefan Exp $'
! !
UUID initialize!