PHP7 des加密   KEY是31位,  需要能在java中解密,以下网上找的,用不了,提示错误
Warning: mcrypt_encrypt(): Key of size 31 not supported by this algorithm. Only keys of size 8 supported 
function encrypt($str, $key)      
{      
    $block = mcrypt_get_block_size('des', 'ecb');
    $pad = $block - (strlen($str) % $block);      
    $str .= str_repeat(chr($pad), $pad);      
      
    return mcrypt_encrypt(MCRYPT_DES, $key, $str, MCRYPT_MODE_ECB);