func (c *crush) hash(r uint8, dataStructureId *ID, hierarchyId []byte) []byte {
	h := hmac.New(sha512.New512_256, []byte("tag"))
	buf := make([]byte, 1)
	buf[0] = byte(r)
	h.Write(buf)
	h.Write(dataStructureId[:])
	h.Write(hierarchyId)
	return h.Sum(nil)
}
// this method uses a crypto "save" random to create a hash
// therefore I *should* be able to achieve a uniform distribution
// r is a counter to modify the hash during each iteration
// dataStructureId is the unique id of the data structure we're trying to place
// hierarchy is either a string (data center / rack) or a uint64 (peer id)
this method uses a crypto "save" random to create a hash
therefore I *should* be able to achieve a uniform distribution
r is a counter to modify the hash during each iteration
dataStructureId is the unique id of the data structure we're trying to place
hierarchy is either a string (data center / rack) or a uint64 (peer id)
// this method uses a crypto " save " random to create a hash // therefore I * should * be able to achieve a uniform distribution // r is a counter to modify the hash during each iteration // dataStructureId is the unique id of the data structure we ' re trying to place // hierarchy is either a string ( data center / rack ) or a uint64 ( peer id )
func (c *crush) hash(r uint8, dataStructureId *ID, hierarchyId []byte) []byte {
	h := hmac.New(sha512.New512_256, []byte("tag"))
	buf := make([]byte, 1)
	buf[0] = byte(r)
	h.Write(buf)
	h.Write(dataStructureId[:])
	h.Write(hierarchyId)
	return h.Sum(nil)
}
func ( c * crush ) hash ( r uint8 , dataStructureId * ID , hierarchyId [ ] byte ) [ ] byte { h := hmac . New ( sha512 . New512_256 , [ ] byte ( " " ) ) buf := make ( [ ] byte , 1 ) buf [ 0 ] = byte ( r ) h . Write ( buf ) h . Write ( dataStructureId [ : ] ) h . Write ( hierarchyId ) return h . Sum ( nil ) }
this method uses a crypto "save" random to create a hash
therefore I *should* be able to achieve a uniform distribution
r is a counter to modify the hash during each iteration
dataStructureId is the unique id of the data structure we're trying to place
hierarchy is either a string (data center / rack) or a uint64 (peer id)
this method uses a crypto " save " random to create a hash therefore I * should * be able to achieve a uniform distribution r is a counter to modify the hash during each iteration dataStructureId is the unique id of the data structure we ' re trying to place hierarchy is either a string ( data center / rack ) or a uint64 ( peer id )