Compare commits

...

2 Commits

Author SHA1 Message Date
6ee4389b57 clean up crypto packages 2025-09-06 21:11:34 -05:00
c97592e485 Update rc4.cpp 2025-09-06 20:20:32 -05:00
6 changed files with 59 additions and 63 deletions

View File

@ -1,8 +1,6 @@
// Copyright (C) 2007-2025 EQ2EMulator
// Licensed under GPL v3
#include <stdio.h>
unsigned long IntArray[] = {
0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA,
0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3,

View File

@ -2,12 +2,11 @@
// Licensed under GPL v3
#include "crypto.h"
#include <algorithm>
#include <array>
#include <cstring>
#include <mutex>
int64 Crypto::RSADecrypt(uchar* text, int16 size) noexcept
int64 Crypto::RSADecrypt(uchar* text, [[maybe_unused]] int16 size) noexcept
{
int64 ret = 0;
std::array<uchar, 8> buffer{};
@ -50,4 +49,3 @@ void Crypto::setRC4Key(int64 key) noexcept
server.reset();
}
}

View File

@ -2,14 +2,14 @@
// Licensed under GPL v3
#include "rc4.h"
#include <algorithm>
#include <cstring>
#include <numeric>
#include <cstddef>
static constexpr std::array<uchar, 256> get_init_state() noexcept
{
std::array<uchar, 256> state{};
std::iota(state.begin(), state.end(), 0);
for (std::size_t i = 0; i < 256; ++i) {
state[i] = static_cast<uchar>(i);
}
return state;
}

View File

@ -1,5 +1,6 @@
// Copyright (C) 2007-2025 EQ2EMulator
// Licensed under GPL v3
#pragma once
#include "../types.h"
@ -19,4 +20,3 @@ private:
uchar m_x{};
uchar m_y{};
};

View File

@ -2,7 +2,6 @@
// Licensed under GPL v3
#include "sha512.h"
#include <algorithm>
#include <cstdio>
#include <cstring>
@ -158,7 +157,7 @@ std::string sha512(std::string_view input) noexcept
ctx.final(digest.data());
std::array<char, 2 * SHA512::DIGEST_SIZE + 1> buf{};
for (int i = 0; i < SHA512::DIGEST_SIZE; ++i) {
for (unsigned int i = 0; i < SHA512::DIGEST_SIZE; ++i) {
std::sprintf(buf.data() + i * 2, "%02x", digest[i]);
}
return std::string{buf.data()};

View File

@ -1,3 +1,6 @@
// Copyright (C) 2007-2025 EQ2EMulator
// Licensed under GPL v3
#pragma once
#include <array>
@ -70,5 +73,3 @@ protected:
| ((uint64) *((str) + 1) << 48) \
| ((uint64) *((str) + 0) << 56); \
}
#endif