For the most sensitive algorithms, if the algorithm cannot be explained in easily understandable language (as determined by a jury), then it's illegal.
(It's how we use paper ballots rather than machines, and especially not everyday computers for voting : the extra risk just isn't worth it.)