Weak isometries of Hamming spaces