rodecomp/Source/Archive/PakCipher.h
ragnarok-clanker f90aef2edf Decompile 2 functions in Source/Archive/PakFile.cpp, Source/Archive/PakCipher.cpp, ...
Batch #13629 by eAthena: 2 byte-identical, 0 confirmed by peer review.

- fn_04016 myGPack::CGPakRead::ReadEntry: byte-identical (already on main)
- fn_18131 myGPack::CGPakRead::DerivePakKey: byte-identical

Merged automatically: every function is byte-identical to the original.
2026-11-06 20:57:16 +00:00

30 lines
954 B
C++

#ifndef RAGNAROK_SOURCE_ARCHIVE_PAKCIPHER_H
#define RAGNAROK_SOURCE_ARCHIVE_PAKCIPHER_H
#include <cstdint>
namespace myGPack {
class PakCipher {
public:
PakCipher();
explicit PakCipher(const std::uint8_t* key);
~PakCipher();
int DecodeBlock(int rounds, const std::uint8_t* input, std::uint8_t* output) const;
int Decode(const std::uint8_t* input, int length, std::uint8_t* output, int* outputLength, int cycle) const;
int DecodePrefix(const std::uint8_t* input, int length, std::uint8_t* output, int* outputLength) const;
private:
/* 0000 */ std::uint8_t m_roundKeys[16][8];
void BuildRoundKeys(const std::uint8_t* key);
};
static_assert(sizeof(PakCipher) == 128);
int InitialPermutation(std::uint8_t* block);
int FinalPermutation(std::uint8_t* block);
int EncodeBlock(int rounds, const std::uint8_t (*roundKeys)[8], std::uint32_t inputLow, std::uint32_t inputHigh, std::uint8_t* output);
}
#endif