Best Use & Engineering Application Guide

Engineering Category: Cryptographic Mixing, Checksums & Wire Integrity

Best Use in Production: High-avalanche 64-bit bijection mixing, deterministic PRNG state stepping, and keyed hash partitioning for hash tables and content addressing.

When to Select This Capsule: Sole canonical implementation for its 64-vector functional equivalence class. Low-latency L1-resident kernel (892479/50000 cyc/op); well-suited for high-frequency pipeline stages.

Snap-Circuit Wiring Role: Slice Ingress / Scanner Stage `(&[u8])->u16` — digests raw byte buffers into scalar tokens or checksums.

Hardware _rdtsc: 892479/50000 cycles/op
Latency: 4251/500 ns/op
Throughput: 500000/4251 ops/us
Compiled ELF64 .text: 311 B (76 x86_64 insns)
C64 64KB RAM Budget: 151/32768 (302 B source)
Ternary Vote: + (score 1) | Salience: 278605/3276
Pure-Rust Capsule Source Code (302 B)
pub fn compute_rfc4034_key_tag(rdata: &[u8]) -> u16 {
    let mut ac: u32 = 0;
    for (i, &b) in rdata.iter().enumerate() {
        if i & 1 != 0 {
            ac += b as u32;
        } else {
            ac += (b as u32) << 8;
        }
    }
    ac += (ac >> 16) & 0xFFFF;
    (ac & 0xFFFF) as u16
}
rustc -C opt-level=3 x86_64 Disassembly (311 B .text / 76 insns)
compute_rfc4034_key_tag:
    test    rsi, rsi
    je    .LBB7_3
    cmp    rsi, 8
    jae    .LBB7_4
    xor    edx, edx
    mov    rax, rdi
    xor    ecx, ecx
    jmp    .LBB7_7
.LBB7_3:
    xor    edx, edx
    mov    eax, edx
    shr    eax, 16
    add    eax, edx
    ret
.LBB7_4:
    movabs    rcx, 9223372036854775800
    and    rcx, rsi
    lea    rax, [rdi + rcx]
    movdqa    xmm0, xmmword ptr [rip + .LCPI7_0]
    movdqa    xmm1, xmmword ptr [rip + .LCPI7_1]
    pxor    xmm2, xmm2
    xor    edx, edx
    movdqa    xmm4, xmmword ptr [rip + .LCPI7_2]
    movdqa    xmm6, xmmword ptr [rip + .LCPI7_3]
    pxor    xmm5, xmm5
    pxor    xmm3, xmm3
.LBB7_5:
    movd    xmm8, dword ptr [rdi + rdx]
    movd    xmm7, dword ptr [rdi + rdx + 4]
    movdqa    xmm9, xmm1
    pand    xmm9, xmm4
    movdqa    xmm10, xmm0
    pand    xmm10, xmm4
    packuswb    xmm9, xmm10
    pcmpeqd    xmm9, xmm2
    punpcklbw    xmm8, xmm2
    punpcklwd    xmm8, xmm2
    punpcklbw    xmm7, xmm2
    punpcklwd    xmm7, xmm2
    movdqa    xmm10, xmm9
    pandn    xmm10, xmm8
    pslld    xmm8, 8
    pand    xmm8, xmm9
    por    xmm8, xmm10
    paddd    xmm5, xmm8
    movdqa    xmm8, xmm9
    pandn    xmm8, xmm7
    pslld    xmm7, 8
    pand    xmm7, xmm9
    por    xmm7, xmm8
    paddd    xmm3, xmm7
    add    rdx, 8
    paddq    xmm1, xmm6
    paddq    xmm0, xmm6
    cmp    rcx, rdx
    jne    .LBB7_5
    paddd    xmm3, xmm5
    pshufd    xmm0, xmm3, 238
    paddd    xmm0, xmm3
    pshufd    xmm1, xmm0, 85
    paddd    xmm1, xmm0
    movd    edx, xmm1
    cmp    rsi, rcx
    je    .LBB7_9
.LBB7_7:
    add    rdi, rsi
.LBB7_8:
    movzx    esi, byte ptr [rax]
    inc    rax
    mov    r8d, esi
    shl    r8d, 8
    test    cl, 1
    cmovne    r8d, esi
    inc    rcx
    add    edx, r8d
    cmp    rax, rdi
    jne    .LBB7_8
.LBB7_9:
    mov    eax, edx
    shr    eax, 16
    add    eax, edx
    ret

Head-to-Head Functional Equivalence Class Peers (1 Implementation(s) Matching 64 Test Vectors)

Global RankCapsule & DomainHardware _rdtscLatencyThroughputELF .textTernary VoteAuthor Aye
#1665compute_rfc4034_key_tag (THIS CAPSULE)
domain: i1-dns-x86_64 | id: 14c277cf7584c3ccc94bbb52b55dbdf5
892479/50000 cyc/op4251/500 ns/op500000/4251 ops/us311 B .text (76 insns)+ (1)aye::Hue+Gemini(0+1)::x86_64 @ 432Hz