  Given two $k\times n$ matrices $A$ and $B$, we describe a couple of methods
to solve the matrix equation $XA=BY$, where $X$ is an invertible $k\times k$
matrix, and $Y$ is an $n\times n$ permutation matrix, both of which we want to
determine. We are interested in pursuing those techniques that have algebraic
geometric flavor. An application to solving such a matrix equation comes from
the cryptanalysis of McEliece cryptosystem. By using codewords of minimum
weight of a linear code, in concordance with these methods of solving $XA=BY$,
we present an efficient way to determine the entire encryption keys for the
McEliece cryptosystems built on Reed-Solomon codes.
