Checksums
0-day streakReview

Your progress

Level 1

0 XP100 XP to level 2
0day streak
0best streak
0topics started
0cards reviewed
    Review cards

    Progress is stored only in this browser. No account is required.

    Layer 3 · Go deeper · 9 min

    Go deeper

    Size it, build it, then make the calls an interviewer will push you on.

    Back of the envelope

    Size it up

    Tap through each step of the arithmetic.

    One server sends 100,000 packets a second. How many corrupt ones pass TCP daily?

      How fast must a scrubber read to cover 16 TB every three weeks?

        What does checking a 25 Gbit/s stream cost in CPU cores?

          Build-up · 6 steps

          Follow one upload’s checksum end to end

          From the uploader’s SDK to three replicas and a scrubber: compute early, verify everywhere, and never hand back bad bytes.

          Step 1 of 6

          Compute at the source

          The client SDK computes CRC-32C before the bytes leave. A checksum computed after a bug has damaged the buffer just certifies garbage.

          4 interview moments

          You’re the candidate

          The interviewer pushes on the hard parts. Pick an approach and see how it holds up.

          1. Deep dive 1 of 4

            Interviewer

            “Phones upload files over HTTPS through your load balancer to an API that writes them to disk. Do you add your own checksum?”

            Your move. Pick an approach:

          2. Deep dive 2 of 4

            Interviewer

            “A Dropbox-style store keeps each chunk once, keyed by its checksum. Which checksum do you key chunks by?”

            A marksheet PDF uploaded by a thousand students to a DigiLocker-style service should be stored once.

            Your move. Pick an approach:

          3. Deep dive 3 of 4

            Interviewer

            “Your API sends webhooks to partners over the internet. How does a partner know a payload is genuine and unaltered?”

            Your move. Pick an approach:

          4. Deep dive 4 of 4

            Interviewer

            “A 50 GB file arrives in S3 as 500 parts of 100 MB. How do you verify the whole object?”

            Your move. Pick an approach:

          Build-up · 6 steps

          Compute TCP’s checksum by hand

          Three 16-bit words, the RFC 1071 recipe used by IPv4, TCP and UDP, and the blind spot that comes with adding.

          Step 1 of 6

          Split into 16-bit words

          Split the bytes into 16-bit words, padding an odd final byte with zero. IPv4 headers, TCP and UDP all use this check, chosen for speed, not strength.