scripted-diff: unify xor-vs-obfuscation nomenclature

Mechanical refactor of the low-level "xor" wording to signal the intent instead of the implementation used.
The renames are ordered by heaviest-hitting substitutions first, and were constructed such that after each replacement the code is still compilable.

-BEGIN VERIFY SCRIPT-
sed -i \
  -e 's/\bGetObfuscateKey\b/GetObfuscation/g' \
  -e 's/\bxor_key\b/obfuscation/g' \
  -e 's/\bxor_pat\b/obfuscation/g' \
  -e 's/\bm_xor_key\b/m_obfuscation/g' \
  -e 's/\bm_xor\b/m_obfuscation/g' \
  -e 's/\bobfuscate_key\b/m_obfuscation/g' \
  -e 's/\bOBFUSCATE_KEY_KEY\b/OBFUSCATION_KEY_KEY/g' \
  -e 's/\bSetXor(/SetObfuscation(/g' \
  -e 's/\bdata_xor\b/obfuscation/g' \
  -e 's/\bCreateObfuscateKey\b/CreateObfuscation/g' \
  -e 's/\bobfuscate key\b/obfuscation key/g' \
  $(git ls-files '*.cpp' '*.h')
-END VERIFY SCRIPT-
This commit is contained in:
Lőrinc
2025-04-25 23:18:48 +02:00
parent 972697976c
commit 0b8bec8aa6
9 changed files with 59 additions and 59 deletions

View File

@@ -63,7 +63,7 @@ namespace dbwrapper_private {
* Database obfuscation should be considered an implementation detail of the
* specific database.
*/
const std::vector<unsigned char>& GetObfuscateKey(const CDBWrapper &w);
const std::vector<unsigned char>& GetObfuscation(const CDBWrapper &w);
}; // namespace dbwrapper_private
@@ -166,7 +166,7 @@ public:
template<typename V> bool GetValue(V& value) {
try {
DataStream ssValue{GetValueImpl()};
ssValue.Xor(dbwrapper_private::GetObfuscateKey(parent));
ssValue.Xor(dbwrapper_private::GetObfuscation(parent));
ssValue >> value;
} catch (const std::exception&) {
return false;
@@ -179,7 +179,7 @@ struct LevelDBContext;
class CDBWrapper
{
friend const std::vector<unsigned char>& dbwrapper_private::GetObfuscateKey(const CDBWrapper &w);
friend const std::vector<unsigned char>& dbwrapper_private::GetObfuscation(const CDBWrapper &w);
private:
//! holds all leveldb-specific fields of this class
std::unique_ptr<LevelDBContext> m_db_context;
@@ -188,12 +188,12 @@ private:
std::string m_name;
//! a key used for optional XOR-obfuscation of the database
std::vector<unsigned char> obfuscate_key;
std::vector<unsigned char> m_obfuscation;
//! the key under which the obfuscation key is stored
static const std::string OBFUSCATE_KEY_KEY;
static const std::string OBFUSCATION_KEY_KEY;
std::vector<unsigned char> CreateObfuscateKey() const;
std::vector<unsigned char> CreateObfuscation() const;
//! path to filesystem storage
const fs::path m_path;
@@ -225,7 +225,7 @@ public:
}
try {
DataStream ssValue{MakeByteSpan(*strValue)};
ssValue.Xor(obfuscate_key);
ssValue.Xor(m_obfuscation);
ssValue >> value;
} catch (const std::exception&) {
return false;