https://github.com/rishidewan33/Advanced-Encryption-Standard-Algorithm/blob/f0581a92615305542bfef2bde81d1c138fd02505/src/AES.java#L591 It should be String h = Integer.toHexString(m[i][j]).toUpperCase();. You invert the i and j. Thanks