public static function valid($key, $cipher)
    {
        $keyLength = mb_strlen($key, '8bit');

        if (static::SUPPORTED_CIPHER_32_LENGTH === $keyLength
            && $cipher === static::SUPPORTED_CIPHER_32) {
            return true;
        }

        if (static::SUPPORTED_CIPHER_16_LENGTH == $keyLength
            && $cipher === static::SUPPORTED_CIPHER_16) {
            return true;
        }

        return false;
    }