mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-23 07:40:14 +00:00
- Vanilla M2 bone struct (108 bytes) with 28-byte animation tracks - Version-aware bone parsing (vanilla vs WotLK format detection) - Fix CharSections.dbc field layout for vanilla (variation/color at 4-5) - Remove broken CharSections.csv files (all fields marked as strings) - Expansion data reload on profile switch (DBC cache clear, layout reload) - Vanilla packet encryption (VanillaCrypt XOR-based header crypt) - Extended character preview geoset range (0-99) for vanilla models - DBC cache clear support in AssetManager
34 lines
849 B
C++
34 lines
849 B
C++
#include "auth/vanilla_crypt.hpp"
|
|
|
|
namespace wowee {
|
|
namespace auth {
|
|
|
|
void VanillaCrypt::init(const std::vector<uint8_t>& sessionKey) {
|
|
key_ = sessionKey;
|
|
sendIndex_ = 0;
|
|
sendPrev_ = 0;
|
|
recvIndex_ = 0;
|
|
recvPrev_ = 0;
|
|
}
|
|
|
|
void VanillaCrypt::encrypt(uint8_t* data, size_t length) {
|
|
for (size_t i = 0; i < length; ++i) {
|
|
uint8_t x = (data[i] ^ key_[sendIndex_]) + sendPrev_;
|
|
sendIndex_ = (sendIndex_ + 1) % key_.size();
|
|
data[i] = x;
|
|
sendPrev_ = x;
|
|
}
|
|
}
|
|
|
|
void VanillaCrypt::decrypt(uint8_t* data, size_t length) {
|
|
for (size_t i = 0; i < length; ++i) {
|
|
uint8_t enc = data[i];
|
|
uint8_t x = (enc - recvPrev_) ^ key_[recvIndex_];
|
|
recvIndex_ = (recvIndex_ + 1) % key_.size();
|
|
recvPrev_ = enc;
|
|
data[i] = x;
|
|
}
|
|
}
|
|
|
|
} // namespace auth
|
|
} // namespace wowee
|