Index

Free, with Google

Keep going, free.

A free account opens lessons 2 and 3 of every track, 33 more lessons, and keeps your progress and review cards on every device.

Start free with Google

A chalk plan

Open everything on chalk.

Every lesson, board, video, lab and paper, and the full review decks. Yearly is $39/year.

See plansStart free instead

Module 05 · From Scratch · Git · with code: Go · about 12 min to read

Play it as a journeyTutor comes with a plan

Git 01: The Blob

Hashing
Hashing · Open board

The hash function at work: any input in, a fixed-size number out, the same number every time. Git’s whole object database is that board used as a filing system, with the number as the file’s name.

Before you start. Build Your Own Git set out the build: git stores a version of your project as objects named by the hash of their contents. This stage builds the smallest object, the blob, which holds the bytes of one file. A hash, as Hashing draws it, is a fingerprint: the same bytes always give the same fingerprint.

Lesson 33 of 117 in From Scratch

The rest of this lesson is part of a plan.

A plan opens every lesson, board, video, lab and paper on chalk. Yearly is $39/year.

See plansAlready a member? Sign in

Or start free: a free account opens lessons 2 and 3 of every track.

In this lesson

  • 20 April 2005: thirteen days in, the hash moves
  • What gets hashed: a header, then the bytes
  • Where the file goes: the first two characters make a folder
  • Same content, same name: storing twice stores once
  • Reading it back, and not trusting what you read
  • Real git reads it

Terms it explains: blob, `hashObject`, `writeObject`, `readObject`, Hashing the compressed bytes, average O(1) vs worst O(n), Bloom filter, bucket, chaining, collision, hash function, hash join, hash set / map, hash table, HashDoS, load factor α, open addressing, resize/rehash, SipHash, tombstone.

Review From Scratch