mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-04-17 09:33:51 +00:00
Initial commit: wowee native WoW 3.3.5a client
This commit is contained in:
commit
ce6cb8f38e
147 changed files with 32347 additions and 0 deletions
55
include/auth/big_num.hpp
Normal file
55
include/auth/big_num.hpp
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <openssl/bn.h>
|
||||
|
||||
namespace wowee {
|
||||
namespace auth {
|
||||
|
||||
// Wrapper around OpenSSL BIGNUM for big integer arithmetic
|
||||
class BigNum {
|
||||
public:
|
||||
BigNum();
|
||||
explicit BigNum(uint32_t value);
|
||||
explicit BigNum(const std::vector<uint8_t>& bytes, bool littleEndian = true);
|
||||
~BigNum();
|
||||
|
||||
// Copy/move operations
|
||||
BigNum(const BigNum& other);
|
||||
BigNum& operator=(const BigNum& other);
|
||||
BigNum(BigNum&& other) noexcept;
|
||||
BigNum& operator=(BigNum&& other) noexcept;
|
||||
|
||||
// Factory methods
|
||||
static BigNum fromRandom(int bytes);
|
||||
static BigNum fromHex(const std::string& hex);
|
||||
static BigNum fromDecimal(const std::string& dec);
|
||||
|
||||
// Arithmetic operations
|
||||
BigNum add(const BigNum& other) const;
|
||||
BigNum subtract(const BigNum& other) const;
|
||||
BigNum multiply(const BigNum& other) const;
|
||||
BigNum mod(const BigNum& modulus) const;
|
||||
BigNum modPow(const BigNum& exponent, const BigNum& modulus) const;
|
||||
|
||||
// Comparison
|
||||
bool equals(const BigNum& other) const;
|
||||
bool isZero() const;
|
||||
|
||||
// Conversion
|
||||
std::vector<uint8_t> toArray(bool littleEndian = true, int minSize = 0) const;
|
||||
std::string toHex() const;
|
||||
std::string toDecimal() const;
|
||||
|
||||
// Direct access (for advanced operations)
|
||||
BIGNUM* getBN() { return bn; }
|
||||
const BIGNUM* getBN() const { return bn; }
|
||||
|
||||
private:
|
||||
BIGNUM* bn;
|
||||
};
|
||||
|
||||
} // namespace auth
|
||||
} // namespace wowee
|
||||
Loading…
Add table
Add a link
Reference in a new issue