well, this is weird ,
Triple Des only accepts 24 bytes as it's key
Each DES key is nominally stored or transmitted as 8 bytes, each of odd parity, so a key bundle requires 24 bytes for option 1, 16 for option 2, or 8 for option 3.
so i think that the problem is in here
DESedeKeySpec object :
/** * Uses the first 24 bytes in <code>key</code> as the DES-EDE key. * <p> * The bytes that constitute the DES-EDE key are those between * <code>key</code> and <code>key</code> inclusive * * @param key the buffer with the DES-EDE key material. * @exception InvalidKeyException if the given key material is shorter * than 24 bytes. */
so i think that
DESedeKeySpec is kind of trimming your 29 length key to 24 to fit it with the
tribledes requirements .
EDIT another important note that mcrypt_* extension has been deprecated .
This function has been DEPRECATED as of PHP 7.1.0. Relying on this function is highly discouraged.