Ejemplo n.º 1
0
func generateMask(rs *random.Source, maskType MaskType, surface Surface) matrix.Matrix {
	if maskType == RandomMask {
		label := make([]byte, 16)

		if surface == Inside {
			copy(label[:], []byte("MASK Inside"))
			return rs.Matrix(label, 128)
		} else {
			copy(label[:], []byte("MASK Outside"))
			return rs.Matrix(label, 128)
		}
	} else { // Identity mask.
		return matrix.GenerateIdentity(128)
	}
}
Ejemplo n.º 2
0
// Generate byte/word mixing bijections.
// TODO: Ensure that blocks are full-rank.
func MixingBijection(rs *random.Source, size, round, position int) matrix.Matrix {
	label := make([]byte, 16)
	label[0], label[1], label[2], label[3], label[4] = 'M', 'B', byte(size), byte(round), byte(position)

	return rs.Matrix(label, size)
}