mirror of
				https://github.com/openimsdk/open-im-server.git
				synced 2025-11-04 19:32:17 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			17 lines
		
	
	
		
			243 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			17 lines
		
	
	
		
			243 B
		
	
	
	
		
			Go
		
	
	
	
	
	
package hashutil
 | 
						|
 | 
						|
import (
 | 
						|
	"crypto/md5"
 | 
						|
	"encoding/binary"
 | 
						|
	"encoding/json"
 | 
						|
)
 | 
						|
 | 
						|
func IdHash(ids []string) uint64 {
 | 
						|
	if len(ids) == 0 {
 | 
						|
		return 0
 | 
						|
	}
 | 
						|
	data, _ := json.Marshal(ids)
 | 
						|
	sum := md5.Sum(data)
 | 
						|
	return binary.BigEndian.Uint64(sum[:])
 | 
						|
}
 |