Type-preserving matrices and security of block ciphers