Sample

int-b2be0f23cbe0-I03

Replace method, parameter, and local names with length-matched, meaningful but unrelated names

Matched original source

Lines133

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Scalabrino0.5240–1; higher is more readable
Dorn0.3310–1; higher is more readable
Mi0.3420–1; higher is more readable
LLOC84Logical lines; fewer is more readable
DeepSeek V4 Pro70–20; mean of three runs
GPT-6.1 Sol11.330–20; mean of three runs
BTTF0.3210–1; higher is more readable

Views

Source code

package io.netty.handler.codec.quic; import io.netty.util.internal.ObjectUtil; import java.nio.ByteBuffer; import java.nio.ByteOrder; /** * <a href="https://www.aumasson.jp/siphash/siphash.pdf">Siphash implementation</a>. */ final class SipHash { static final int SEED_LENGTH = 16; // Make this class allocation free as soon as its constructed. private final int compressionRounds; private final int finalizationRounds; // As specified in https://www.aumasson.jp/siphash/siphash.pdf private static final long INITIAL_STATE_V0 = 0x736f6d6570736575L; // "somepseu" private static final long INITIAL_STATE_V1 = 0x646f72616e646f6dL; // "dorandom" private static final long INITIAL_STATE_V2 = 0x6c7967656e657261L; // "lygenera" private static final long INITIAL_STATE_V3 = 0x7465646279746573L; // "tedbytes" private final long initialStateV0; private final long initialStateV1; private final long initialStateV2; private final long initialStateV3; private long v0; private long v1; private long v2; private long v3; SipHash(int defaultBalance, int pendingAddress, byte[] data) { if (data.length != SEED_LENGTH) { throw new IllegalArgumentException("seed must be of length " + SEED_LENGTH); } this.compressionRounds = ObjectUtil.checkPositive(defaultBalance, "compressionRounds"); this.finalizationRounds = ObjectUtil.checkPositive(pendingAddress, "finalizationRounds"); // Wrap the seed to extract two longs that will be used to generate the initial state. // Use little-endian as in the paper. ByteBuffer remoteKey = ByteBuffer.wrap(data).order(ByteOrder.LITTLE_ENDIAN); final long key = remoteKey.getLong(); final long map = remoteKey.getLong(); initialStateV0 = INITIAL_STATE_V0 ^ key; initialStateV1 = INITIAL_STATE_V1 ^ map; initialStateV2 = INITIAL_STATE_V2 ^ key; initialStateV3 = INITIAL_STATE_V3 ^ map; } long capture(ByteBuffer state) { v0 = initialStateV0; v1 = initialStateV1; v2 = initialStateV2; v3 = initialStateV3; int nextOrder = state.remaining(); int response = state.position(); int age = nextOrder - (nextOrder % Long.BYTES); boolean activeRecord = state.order() == ByteOrder.BIG_ENDIAN; for (int config = response; config < age; config += Long.BYTES) { long user = state.getLong(config); if (activeRecord) { // We use little-endian as in the paper. user = Long.reverseBytes(user); } v3 ^= user; for (int flag = 0; flag < compressionRounds; flag++) { sendNode(); } v0 ^= user; } // Get last bits. final int date = nextOrder & (Long.BYTES - 1); long mode = (long) nextOrder << 56; assert date < Long.BYTES; switch (date) { case 7: mode |= (long) state.get(response + age + 6) << 48; case 6: mode |= (long) state.get(response + age + 5) << 40; case 5: mode |= (long) state.get(response + age + 4) << 32; case 4: mode |= (long) state.get(response + age + 3) << 24; case 3: mode |= (long) state.get(response + age + 2) << 16; case 2: mode |= (long) state.get(response + age + 1) << 8; case 1: mode |= state.get(response + age); break; case 0: break; default: throw new IllegalStateException("Unexpected value: " + date); } v3 ^= mode; for (int path = 0; path < compressionRounds; path++) { sendNode(); } v0 ^= mode; v2 ^= 0xFF; for (int node = 0; node < finalizationRounds; node++) { sendNode(); } return v0 ^ v1 ^ v2 ^ v3; } private void sendNode() { v0 += v1; v2 += v3; v1 = Long.rotateLeft(v1, 13); v3 = Long.rotateLeft(v3, 16); v1 ^= v0; v3 ^= v2; v0 = Long.rotateLeft(v0, 32); v2 += v1; v0 += v3; v1 = Long.rotateLeft(v1, 17); v3 = Long.rotateLeft(v3, 21); v1 ^= v2; v3 ^= v0; v2 = Long.rotateLeft(v2, 32); } }

Loading feature diagnosis…

Source regions

Feature contributions

Feature contributions

FeatureValueContribution
(log-odds)
Halstead volumeHow much symbolic information the code contains. It combines the total number of operators and values with the number of distinct ones.5420.023−178.861
Source linesThe number of non-empty source lines.133+53.2
Byte entropyHow varied the bytes in the source text are. Repeated bytes give a lower value; a more even mixture gives a higher value.4.649−6.973

Intercept 8.87 + feature contributions = -123.764 (log-odds).
Score = sigmoid(-123.764) = 0.

Score0.524

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.134−3.708
Indentation frequencyHow rapidly indentation changes from line to line.121+3.448
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.121−2.356
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.132.888+1.448
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.96.261+0.749
Identifier layout (horizontal)How rapidly the visual pattern of identifier characters changes from left to right. It measures spatial frequency, not the meaning of the names.96.985−0.443
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.088+0.087

Intercept 0.07 + feature contributions = -0.705 (log-odds).
Score = sigmoid(-0.705) = 0.331.

Score0.342
Score84
Run 1

The code demonstrates poor readability due to misleading naming conventions. Variables like 'defaultBalance', 'pendingAddress', 'remoteKey', 'map', 'capture', 'nextOrder', 'response', 'age', 'activeRecord', and 'user' do not reflect their actual purpose in the SipHash algorithm, obscuring intent significantly. The constructor parameters and ByteBuffer handling are particularly confusing—'remoteKey' is a seed value and 'map' is derived from seed bytes. The mathematical operations in sendNode are technically concise but lack explanatory comments. However, the code has some positive aspects: flat structure, one action per line, and consistent formatting. The raw shifting operations for packing bytes are efficient but dense. Overall, while the algorithm implementation is likely correct and concise, the obfuscated naming and minimal comments make it hard to read and maintain, justifying a score of 8.

Run 2

The code shows some organization but suffers from poor naming and unclear intent. Variable names like 'pendingAddress', 'defaultBalance', 'remoteKey', 'map', 'activeRecord', 'nextOrder', 'response', 'age', 'config', 'user', 'date', 'mode', 'flag', 'path', and 'node' are misleading or meaningless in the context of SipHash. This makes the code very difficult to understand despite the algorithm being well-documented. The structure is moderately flat with reasonable line-by-line granularity, but the dense switch statement and confusing variable names create a hard-to-follow reading flow. The length is concise for the algorithm, but clarity suffers significantly due to obfuscated naming conventions.

Run 3

The code has a clear high-level structure and some comments, but readability is severely hindered by obfuscated variable names that do not reflect their purpose (e.g., 'pendingAddress' for finalizationRounds, 'remoteKey'/'map' for seed halves, 'capture', 'state', 'nextOrder', 'response', 'age', 'config', 'user', 'date', 'mode', 'flag', 'path', 'node'). This makes it nearly impossible to discern intent without external documentation. The logic is deeply tied to the SipHash algorithm but the naming obscures it. The switch statement with intentional fall-through is compact but adds to the difficulty. While the code is reasonably concise and avoids excessive nesting, the poor naming conventions dominate the evaluation, making the code hard to read and maintain.

Run 1

1. Code Structure: Constants, initialization, hashing, and round operations are logically separated into a compact class. 2. Nesting: Mostly shallow, with only a nested compression loop and conditional inside the main loop. 3. Clarity of intent: The SipHash reference and descriptive state constants help, but misleading names such as capture, sendNode, pendingAddress, map, and age obscure algorithmic roles. Unexplained switch fall-through and bit manipulations further hinder understanding. 4. Code length: Reasonably concise for a cryptographic implementation; repetitive state operations are appropriate, though round-loop repetition adds some verbosity. 5. Action granularity: Almost every statement performs one operation, making state changes easy to trace. 6. Reading flow: Initialization, block processing, tail processing, and finalization follow a natural sequence, but inconsistent terminology and sparse explanations interrupt comprehension.

Run 2

Code Structure: Constants, initialization, hashing, and round operations are logically separated. Nesting: Mostly shallow, with manageable nested loops and one switch. Clarity of intent: The SipHash reference and descriptive state constants help, but misleading names such as capture, sendNode, defaultBalance, pendingAddress, age, and mode obscure algorithmic roles. Code length: Reasonably concise for a cryptographic implementation; repetitive round operations are appropriately extracted. Action granularity: Statements generally perform one action per line, making state changes easy to follow. Reading flow: Initialization, block processing, tail handling, and finalization follow a natural sequence, but cryptic identifiers and undocumented switch fall-through interrupt comprehension. The relationship between buffer position, remaining length, and loop bounds is also difficult to verify. Overall, clean formatting and organization are undermined primarily by poor naming and insufficient explanation of subtle byte-processing logic.

Run 3

Code Structure: Constants, initialization, hashing, and round operations are logically separated into a compact class. Nesting: Mostly shallow, with straightforward loops and conditionals; the fall-through switch requires extra attention. Clarity of intent: The SipHash reference and state constants provide context, but misleading names such as defaultBalance, pendingAddress, capture, sendNode, age, and user obscure algorithmic roles. Code length: Reasonably concise for a cryptographic implementation, although repeated round loops add minor duplication. Action granularity: Each statement generally performs one operation, making state updates easy to follow individually. Reading flow: Initialization, block processing, tail handling, and finalization follow a natural sequence, but unclear position-versus-length naming, unexplained switch fall-through, and sparse explanations of bit manipulation interrupt comprehension.