Basha256.sh – Pure Bash 3.2 implementation of sha256
A pure Bash 3.2 implementation of the SHA-256 hash algorithm, called basha256.sh, has been shared on GitHub. The script provides a way to compute SHA-256 hashes without relying on external tools or utilities.
Background
- **Oded ("Oz") Katz** is a well-known Israeli software engineer and co-founder of Treeverse, the company behind lakeFS (an open-source data platform for data lakes). He often posts deep technical deep-dives.
- **Bash 3.2** is the default shell on macOS (pre-Catalina) and older enterprise Linux distributions. It predates associative arrays, `printf -v`, and many modern Bash features. Writing anything non-trivial in it is considered a significant constraint.
- **SHA-256** is a cryptographic hash function used everywhere (Git, HTTPS certificates, blockchain). Implementing it in pure Bash — with no external commands like `openssl`, `sha256sum`, or `python` — is a deliberate technical exercise.
- This gist is a showcase of low-level systems thinking: manually implementing bitwise rotations, modular addition, and the SHA-256 compression function using only shell builtins. It matters because it demonstrates that even a supposedly "limited" shell can perform serious computation, and it's a useful reference for anyone working in extremely restricted environments (e.g., minimal containers, embedded systems, or audit situations where no external tools are permitted).