MCPcopy Create free account
hub / github.com/e2wugui/zeze / hash64

Method hash64

ZezeJava/ZezeJava/src/main/java/Zeze/Transaction/Bean.java:169–175  ·  view source on GitHub ↗
(long initial, @NotNull String name, int n)

Source from the content-addressed store, hash-verified

167 // 使用自己的hash算法,因为 TypeId 会持久化,不能因为算法改变导致值变化。
168 // XXX: 这个算法定好之后,就不能变了。
169 public static long hash64(long initial, @NotNull String name, int n) {
170 // This is a Knuth hash
171 long hashedValue = initial;
172 for (int i = 0; i < n; i++)
173 hashedValue = (hashedValue + name.charAt(i)) * 3074457345618258799L;
174 return hashedValue;
175 }
176
177 public static long hash64(@NotNull String name, int n) {
178 return hash64(3074457345618258791L, name, n);

Callers 15

mainMethod · 0.95
testConsistentHashMethod · 0.95
ProviderDistributeClass · 0.95
typeIdMethod · 0.95
hash32Method · 0.95
hashLogMethod · 0.95
Meta1Class · 0.95
Meta2Class · 0.95
genVirtualIdsMethod · 0.95
loadClassNameMethod · 0.95
reloadClassNameMethod · 0.95
LogMap1Class · 0.45

Calls

no outgoing calls

Tested by 2

mainMethod · 0.76
testConsistentHashMethod · 0.76