Debian Codegraph @

src/lib/QXPDeobfuscator.cpp

raw
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /*
3 * This file is part of the libqxp project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
9
10 #include "QXPDeobfuscator.h"
11
12 namespace libqxp
13 {
14
15 QXPDeobfuscator::QXPDeobfuscator(uint16_t seed)
16 : m_seed(seed)
17 {
18 }
19
20 uint16_t QXPDeobfuscator::operator()(uint16_t value) const
21 {
22 return value + m_seed - ((value & m_seed) << 1);
23 }
24
25 uint8_t QXPDeobfuscator::operator()(uint8_t value) const
26 {
27 return operator()(uint16_t(value)) & 0xff;
28 }
29
30 }
31
32 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */