macHash() — netty Function Reference
Architecture documentation for the macHash() function in SipHash.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 901f01bc_21b3_69fb_38c8_2e3a75334e00["macHash()"] 32c45fc1_8885_8768_58c7_65f5ff579eb7["SipHash"] 901f01bc_21b3_69fb_38c8_2e3a75334e00 -->|defined in| 32c45fc1_8885_8768_58c7_65f5ff579eb7 62ea4b31_3219_5aab_2cc2_04bbec862c0a["sipround()"] 901f01bc_21b3_69fb_38c8_2e3a75334e00 -->|calls| 62ea4b31_3219_5aab_2cc2_04bbec862c0a style 901f01bc_21b3_69fb_38c8_2e3a75334e00 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
codec-classes-quic/src/main/java/io/netty/handler/codec/quic/SipHash.java lines 69–129
long macHash(ByteBuffer input) {
v0 = initialStateV0;
v1 = initialStateV1;
v2 = initialStateV2;
v3 = initialStateV3;
int remaining = input.remaining();
int position = input.position();
int len = remaining - (remaining % Long.BYTES);
boolean needsReverse = input.order() == ByteOrder.BIG_ENDIAN;
for (int offset = position; offset < len; offset += Long.BYTES) {
long m = input.getLong(offset);
if (needsReverse) {
// We use little-endian as in the paper.
m = Long.reverseBytes(m);
}
v3 ^= m;
for (int i = 0; i < compressionRounds; i++) {
sipround();
}
v0 ^= m;
}
// Get last bits.
final int left = remaining & (Long.BYTES - 1);
long b = (long) remaining << 56;
assert left < Long.BYTES;
switch (left) {
case 7:
b |= (long) input.get(position + len + 6) << 48;
case 6:
b |= (long) input.get(position + len + 5) << 40;
case 5:
b |= (long) input.get(position + len + 4) << 32;
case 4:
b |= (long) input.get(position + len + 3) << 24;
case 3:
b |= (long) input.get(position + len + 2) << 16;
case 2:
b |= (long) input.get(position + len + 1) << 8;
case 1:
b |= input.get(position + len);
break;
case 0:
break;
default:
throw new IllegalStateException("Unexpected value: " + left);
}
v3 ^= b;
for (int i = 0; i < compressionRounds; i++) {
sipround();
}
v0 ^= b;
v2 ^= 0xFF;
for (int i = 0; i < finalizationRounds; i++) {
sipround();
}
return v0 ^ v1 ^ v2 ^ v3;
}
Domain
Subdomains
Calls
Source
Frequently Asked Questions
What does macHash() do?
macHash() is a function in the netty codebase, defined in codec-classes-quic/src/main/java/io/netty/handler/codec/quic/SipHash.java.
Where is macHash() defined?
macHash() is defined in codec-classes-quic/src/main/java/io/netty/handler/codec/quic/SipHash.java at line 69.
What does macHash() call?
macHash() calls 1 function(s): sipround.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free