Data obfuscator: development [#CLICKHOUSE-2]

This commit is contained in:
Alexey Milovidov 2018-06-15 12:07:42 +03:00
parent bd5247864b
commit 3de1efa2c2

View File

@ -18,6 +18,7 @@
#include <DataStreams/IBlockOutputStream.h>
#include <Common/SipHash.h>
#include <Common/UTF8Helpers.h>
#include <Common/StringUtils/StringUtils.h>
#include <Common/HashTable/HashMap.h>
#include <Common/typeid_cast.h>
#include <Core/Block.h>
@ -247,7 +248,7 @@ public:
};
/// Just pseudorandom function.
/// Pseudorandom function, but keep word characters as word characters.
void transformFixedString(const UInt8 * src, UInt8 * dst, size_t size, UInt64 seed)
{
{
@ -273,6 +274,15 @@ void transformFixedString(const UInt8 * src, UInt8 * dst, size_t size, UInt64 se
pos += 16;
++i;
}
for (size_t j = 0; j < size; ++j)
{
if (isWordCharASCII(src[j]))
{
static constexpr char word_chars[] = "_01234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
dst[j] = word_chars[dst[j] % sizeof(word_chars)];
}
}
}