Kelsidavis-WoWee/src/auth/vanilla_crypt.cpp
Kelsi 430c2bdcfa Vanilla/Turtle WoW support: M2 loading, bone parsing, textures, auth
- 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
2026-02-13 16:53:28 -08:00

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