⚛ sha2.fail / docs

Q#

Q# is Microsoft’s domain-specific quantum programming language. It is strongly typed, designed for resource estimation, and has excellent support for reversible arithmetic and oracle construction.

Minimal reversible example

namespace Sha2Fail.Example {
    open Microsoft.Quantum.Canon;
    open Microsoft.Quantum.Intrinsic;

    operation ReversibleXor(a : Qubit, b : Qubit, out : Qubit) : Unit is Adj + Ctl {
        CNOT(a, out);
        CNOT(b, out);
    }

    operation ToffoliStep(a : Qubit, b : Qubit, c : Qubit) : Unit is Adj + Ctl {
        CCNOT(a, b, c);
    }
}

The is Adj + Ctl signature tells the compiler that the operation is reversible, so Q# can automatically generate the uncomputation. This is extremely useful for keeping ancilla clean in SHA-256.

Mirrored circuit code

Microsoft Research published complete Q# Grover oracles for AES and LowMC in the microsoft/grover-blocks repository. We mirror the AES subset here as a reference for writing similar SHA-256 oracles:

License: MIT (Microsoft). Full license is included in the mirror directory.