C++ Вопрос _xorstr крашит

Начинающий
Статус
Оффлайн
Регистрация
26 Апр 2022
Сообщения
30
Реакции[?]
2
Поинты[?]
0
Для шифрования строк в своем билде использую данный код:
Пожалуйста, авторизуйтесь для просмотра ссылки.

Сам билд работает на моем ПК, но у других людей почему-то крашит. Кто нибудь знает, в чем проблема?
 
НЕКАСЕСТВЕНЫЙ КАД
Участник
Статус
Оффлайн
Регистрация
27 Фев 2019
Сообщения
1,425
Реакции[?]
252
Поинты[?]
4K
#define JM_XORSTR_DISABLE_AVX_INTRINSICS
попробуй это
 
Начинающий
Статус
Оффлайн
Регистрация
7 Окт 2022
Сообщения
90
Реакции[?]
9
Поинты[?]
9K
Пользователь
Статус
Оффлайн
Регистрация
8 Апр 2022
Сообщения
656
Реакции[?]
102
Поинты[?]
65K
Начинающий
Статус
Оффлайн
Регистрация
7 Окт 2022
Сообщения
90
Реакции[?]
9
Поинты[?]
9K
ВМПротектДекриптСтринг?
человек про xor спрашивал, не про вмп. я ему посоветовал две альтернативы, которые не сильно лучше но более новые будут, деф xor`y уже 6 лет как никак. я акцент на текущем году поэтому и сделал.

edit: я не выставляю это в виде адекватной защиты, если тип просто строки скрыть хочет в своей пасте то так банально легче будет.
 
Начинающий
Статус
Оффлайн
Регистрация
26 Апр 2022
Сообщения
30
Реакции[?]
2
Поинты[?]
0
Актуально.
К сожалению #define JM_XORSTR_DISABLE_AVX_INTRINSICS не помогло, у людей почему-то крашит билд.
Может есть альтернативы xorstr_ ?
 
Начинающий
Статус
Оффлайн
Регистрация
13 Май 2023
Сообщения
144
Реакции[?]
26
Поинты[?]
26K
Актуально.
К сожалению #define JM_XORSTR_DISABLE_AVX_INTRINSICS не помогло, у людей почему-то крашит билд.
Может есть альтернативы xorstr_ ?
C++:
#pragma region Xor

template <int X> struct EnsureCompileTime
{
    enum : int
    {
        Value = X
    };
};

constexpr int LinearCongruentGenerator()
{
    constexpr auto date = __DATE__;
    constexpr auto seed_d = static_cast<int>(date[9]) * 200 + static_cast<int>(date[8]) * 700 + static_cast<int>(date[7]) * 6000 + static_cast<int>(date[6]) * 200 + static_cast<int>(date[4]) * 600 + static_cast<int>(date[3]) * 600 + static_cast<int>(date[1]) * 3600 + static_cast<int>(date[0]) * 36000;
    constexpr auto time = __TIME__;
    constexpr auto seed_t = static_cast<int>(time[7]) + static_cast<int>(time[6]) * 200 + static_cast<int>(time[4]) * 600 + static_cast<int>(time[3]) * 600 + static_cast<int>(time[1]) * 3600 + static_cast<int>(time[0]) * 36000;
    constexpr auto seed = (seed_d + seed_t)/4;

    return seed/*1013904223 + 1664525 * ((Rounds > 0) ? LinearCongruentGenerator(Rounds - 1) : seed & 0xFFFFFFFF)*/;
}
#define Random() EnsureCompileTime<LinearCongruentGenerator()>::Value
#define RandomNumber(Min, Max) (Min + (Random() % (Max - Min + 1)))

template <int... Pack> struct IndexList {};
template <typename IndexList, int Right> struct Append;
template <int... Left, int Right> struct Append<IndexList<Left...>, Right>
{
    typedef IndexList<Left..., Right> Result;
};

template <int N> struct ConstructIndexList
{
    typedef typename Append<typename ConstructIndexList<N - 1>::Result, N - 1>::Result Result;
};

template <> struct ConstructIndexList<0>
{
    typedef IndexList<> Result;
};

#pragma warning(disable : 4307)
#pragma warning(disable : 4309)

template <typename Char_tp, typename IndexList> class crypte;
template <typename Char_tp, int... Index> class crypte<Char_tp, IndexList<Index...> >
{
private:
    Char_tp Value[sizeof...(Index) + 1];
    static const Char_tp XORKEY = static_cast<Char_tp>(RandomNumber(0, 0xFFFF));
    template <typename Char_tp>
    constexpr Char_tp EncryptCharacterT(const Char_tp Character, int Index)
    {
        return Character ^ (XORKEY + Index);
    }
public:
    __forceinline constexpr crypte(const Char_tp* const String) : Value{ EncryptCharacterT(String[Index], Index)... } {}

    const Char_tp* decrypt()
    {
        for (int t = 0; t < sizeof...(Index); t++)
        {
            Value[t] = Value[t] ^ (XORKEY + t);
        }
        Value[sizeof...(Index)] = static_cast<Char_tp>(0);
        return Value;
    }
    const Char_tp* get()
    {
        return Value;
    }
};


#define xor_s( text ) ( crypte<CHAR, ConstructIndexList<(sizeof( text ) - 1)>::Result>( text ).decrypt() )
#define xor_w( text ) ( crypte<wchar_t, ConstructIndexList<(sizeof( text ) - 1) / 2>::Result>( text ).decrypt() )
#pragma endregion
 
Начинающий
Статус
Оффлайн
Регистрация
2 Фев 2022
Сообщения
68
Реакции[?]
14
Поинты[?]
19K
Актуально.
К сожалению #define JM_XORSTR_DISABLE_AVX_INTRINSICS не помогло, у людей почему-то крашит билд.
Может есть альтернативы xorstr_ ?
Отключи оптимизацию всей программы (Свойства проекта -> C/C++ -> Оптимизация -> Оптимизация всей программы: Нет) :roflanBuldiga:
 
I Want to Die in New Orleans
Участник
Статус
Оффлайн
Регистрация
10 Окт 2020
Сообщения
506
Реакции[?]
491
Поинты[?]
80K
C++:
#define xor_s( text ) ( crypte<CHAR, ConstructIndexList<(sizeof( text ) - 1)>::Result>( text ).decrypt() )
#define xor_w( text ) ( crypte<wchar_t, ConstructIndexList<(sizeof( text ) - 1) / 2>::Result>( text ).decrypt() )
decltype(text[0]) ?

C++:
constexpr int LinearCongruentGenerator()
{
    constexpr auto date = __DATE__;
    constexpr auto seed_d = static_cast<int>(date[9]) * 200 + static_cast<int>(date[8]) * 700 + static_cast<int>(date[7]) * 6000 + static_cast<int>(date[6]) * 200 + static_cast<int>(date[4]) * 600 + static_cast<int>(date[3]) * 600 + static_cast<int>(date[1]) * 3600 + static_cast<int>(date[0]) * 36000;
    constexpr auto time = __TIME__;
    constexpr auto seed_t = static_cast<int>(time[7]) + static_cast<int>(time[6]) * 200 + static_cast<int>(time[4]) * 600 + static_cast<int>(time[3]) * 600 + static_cast<int>(time[1]) * 3600 + static_cast<int>(time[0]) * 36000;
    constexpr auto seed = (seed_d + seed_t)/4;

    return seed/*1013904223 + 1664525 * ((Rounds > 0) ? LinearCongruentGenerator(Rounds - 1) : seed & 0xFFFFFFFF)*/;
}
range-based loop ?


выражаю искренние сомнения тому факту что это "замена" для xorstr от jm`a
лучше уже skcrypt юзать, а ещё лучше - найти проблему в xor`е от jm
 
Начинающий
Статус
Онлайн
Регистрация
28 Окт 2021
Сообщения
283
Реакции[?]
25
Поинты[?]
16K
Сверху Снизу