  We implement a quantum hashing algorithm which is based on a fingerprinting
technique presented by Ambainis and Frievalds, 1988, on gate-based quantum
computers. This algorithm is based on a quantum finite automaton for a unary
language $\mathtt{MOD_p}$, where $ \mathtt{MOD_p} = \{ a^{i \cdot p} \mid i
\geq 0 \} $, for any prime number $p$. We consider 16-qubit and 27-qubit IBMQ
computers with the special graphs of qubits representing nearest neighbor
architecture that is not Linear Nearest Neighbor (LNN) one. We optimize quantum
circuits for the quantum hashing algorithm with respect to minimizing the
number of control operators as the most expensive ones. We apply the same
approach for an optimized circuit implementation of Quantum Fourier Transform
(QFT) operation on the aforementioned machines because QFT and hashing circuits
have common parts.
