Signμ(sk, μ):

  # Referred to as 'ExternalMu-ML-DSA.Sign(sk, mu)'
  # in the FIPS 204 FAQ.

  if |μ| != 64 then
    return error  # return an error indication if the input μ is not
                  # 64 bytes.
  end if

  rnd = rand(32)  # for the optional deterministic variant,
                  # set rnd to all zeroes
  if rnd = NULL then
    return error  # return an error indication if random bit
                  # generation failed
  end if

  sigma = Signμ_internal(sk, μ, rnd, isExternalμ=true)
  return sigma

ML-DSA.Signμ_internal(sk, M', rnd, isExternalμ=false):
    # μ is passed to the function via the argument M'.
    # Defaulting Externalμ to false means that
    # this modified version of Sign_internal can be used
    # in place of the original without interfering with
    # functioning of pure ML-DSA mode.

    # ... identical to FIPS 204 Algorithm 7, but with Line 6
    # replaced with
  6: if (isExternalμ):
       μ = M'
     else:
       μ = H(BytesToBits(tr) || M', 64)
