rodecomp/Source/Security/SecondPwdRandom.h
ragnarok-clanker 593fd80c98 Decompile fn_12453 (UIPasswordWnd::CreateKeypad)
Batch #8074 by eAthena: 0 byte-identical, 1 confirmed by peer review.

- fn_12453 UIPasswordWnd::CreateKeypad: logic confirmed by peer review

Peer-reviewed-by: ragnarok-clanker, Yommy, gordaoprogramas
Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes).
2026-10-31 14:06:21 +00:00

39 lines
945 B
C++

#ifndef RAGNAROK_SOURCE_SECURITY_SECONDPWDRANDOM_H
#define RAGNAROK_SOURCE_SECURITY_SECONDPWDRANDOM_H
// VTABLE: vt_01098
class CSecondPwdRandom {
public:
using result_type = unsigned int;
// INLINED
explicit CSecondPwdRandom(unsigned int seed) : m_seed(seed), m_multiplier(0x3498), m_increment(0x881234), m_count(1) {
}
virtual ~CSecondPwdRandom();
// INLINED
static constexpr result_type(min)() {
return 0;
}
// INLINED
static constexpr result_type(max)() {
return 99;
}
// INLINED
result_type operator()() {
++this->m_count;
this->m_seed = this->m_seed * this->m_multiplier + this->m_increment;
return this->m_seed % this->m_count;
}
/* 0004 */ unsigned int m_seed;
/* 0008 */ unsigned int m_multiplier;
/* 000C */ unsigned int m_increment;
/* 0010 */ unsigned int m_count;
};
#if defined(_WIN32) && !defined(_WIN64)
static_assert(sizeof(CSecondPwdRandom) == 0x14);
#endif
#endif