Blog | G5 Cyber Security

Type Safe Languages & Predictable Builds

TL;DR

Yes, several type safe languages offer deterministic compilers. This means given the same input code and compiler version, you’ll *always* get the same output binary (or compiled result). Rust, Haskell, and PureScript are excellent choices. Determinism is crucial for reproducible builds, supply chain security, and reliable deployments.

Understanding the Problem

A deterministic compiler produces identical outputs from identical inputs. Non-deterministic compilers can vary output due to factors like timestamps, build order dependencies, or internal state. This makes it hard to verify software integrity and creates problems for automated builds.

Solution: Languages with Deterministic Compilers

  1. Rust
  • Haskell
  • PureScript
  • Other Considerations:
  • Verifying Determinism

    1. Binary Comparison: After each build, compare the generated binary (or compiled output) with a known good version using tools like diff or checksums (e.g., SHA256).
    2. Reproducible Builds Project: Explore resources from the Reproducible Builds project for more advanced techniques and tooling.
    Exit mobile version