1. An apparatus comprising a substitution component that performs substitution based on a triangular matrix and an input vector to generate an output vector, the apparatus comprising: memory that stores output sub-vectors of the output vector; a first permuter that permutates one or more previously generated output sub-vectors of the output vector based on one or more corresponding permutation coefficients to generate one or more permuted sub-vectors, wherein each permutation coefficient corresponds to a different sub-matrix in a current block row of the triangular matrix; an XOR gate array that performs exclusive disjunction on (i) the one or more permuted sub-vectors and (ii) a current input sub-vector of the input vector to generate an intermediate sub-vector; a second permuter that permutates the intermediate sub-vector based on a permutation coefficient corresponding to another sub-matrix in the current block row to generate a current output sub-vector of the output vector.