diff options
Diffstat (limited to 'src/pso')
-rw-r--r-- | src/pso/PSOV3Encryption.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/pso/PSOV3Encryption.cpp b/src/pso/PSOV3Encryption.cpp index 465249e..30c5586 100644 --- a/src/pso/PSOV3Encryption.cpp +++ b/src/pso/PSOV3Encryption.cpp @@ -26,12 +26,13 @@ void PSOV3Encryption::update_stream() { for (u32 *p = ptr; p != m_buffer_end; *p++ ^= *start++); } -void PSOV3Encryption::encrypt(u32 seed) { +void PSOV3Encryption::init(u32 seed) { const size_t size = m_buffer.size(); u32 thing; m_buffer_end = &m_buffer[size]; m_buffer_start = m_buffer.start(); u32 value = 0; + for (int i = 0; i <= 16; ++i, *m_buffer_start++ = value) { for (int j = 32; j; --j) { seed *= 0x5d588b65; @@ -39,13 +40,9 @@ void PSOV3Encryption::encrypt(u32 seed) { } } - //u32 *smth = &m_buffer[0]; - //u32 *smth2 = &m_buffer[1]; --m_buffer_start; thing = m_buffer[0xf]; *m_buffer_start = (m_buffer[0] >> 9) ^ (*m_buffer_start << 23) ^ thing; - //u32 *buf_val = &m_buffer[0]; - //u32 *next_buf_val = &m_buffer[1]; for (u32 *buf_val = &m_buffer[0], *next_buf_val = &m_buffer[1], *buf = m_buffer_start++; m_buffer_start != m_buffer_end;) { *m_buffer_start++ = (*buf_val++ << 23) ^ (*next_buf_val++ >> 9) ^ *buf++; @@ -64,7 +61,7 @@ PSOV3Encryption::~PSOV3Encryption() { } PSOV3Encryption::PSOV3Encryption() : PSOEncryption() { - encrypt(0); + init(0); } |