Systems for obfuscation and manipulation of strings for digital asset protection
Obfuscation techniques are provided for generating data such that the data remains private, data tampering is prevented, and reverse engineering is deterred. One such technique is a Stealthy String technique in which special meaning is encoded into seemingly random strings. Another such technique is a Blended String technique in which multiple strings are merged in a randomly parameterized manner.
1 . A computer-implemented method for merging strings of data in a randomly parameterized manner, the method comprising:
receiving, by a computing device, a first string and a second string;
calculating, by the computing device, a compressed string length, based on a length of the first string, a length of the second string, or lengths of the first and second strings;
calculating, by the computing device, a shuffle key length;
generating, by the computing device, a shuffle key having a number of bytes that corresponds to the calculated shuffle key length, wherein generating the shuffle key comprises an application of a random function, and wherein the shuffle key is a bit pattern that comprises a randomized series of zero-bits and one-bits;
calculating, by the computing device, a first chunk size for the first string;
calculating, by the computing device, a second chunk size for the second string;
sequentially traversing the shuffle key, by the computing device, to determine a series of shuffle key bits;
for each shuffle key bit in the series of shuffle key bits, (i) in response to the shuffle key bit being a zero-bit, adding a next chunk of the first string having the first chunk size to a merged string, or (ii) in response to the shuffle key bit being a one-bit, adding a next chunk of the second string having the second chunk size to the merged string;
generating, by the computing device, a header that comprises the compressed string length, the shuffle key length, and the shuffle key; and
transmitting, by the computing device to another computing device, the merged string and the header.
2 . The computer-implemented method of claim 1 , wherein the first string includes at least one of a directory name, a file name, an encryption key, and a signature, and wherein the second string includes randomly generated noise.
3 . The computer-implemented method of claim 1 , further comprising performing an obfuscation process on the first string.
4 . The computer-implemented method of claim 1 , further comprising performing an obfuscation process on the merged string.
5 . The computer-implemented method of claim 1 , wherein calculating the shuffle key length comprises:
determining, from the first string and the second string, a string having a lesser string length;
determining a lesser key length value by doubling the lesser string length; and
selecting as the shuffle key length, the lesser key length value.
6 . The computer-implemented method of claim 5 , further comprising:
receiving, by the computing device, a shuffle complexity value, wherein calculating the shuffle key length comprises:
determining a recommended shuffle key length value by multiplying the shuffle complexity value by a predetermined shuffle size constant;
comparing the recommended shuffle key length value to the lesser key length value, and
selecting as the shuffle key length, a lesser of the recommended shuffle key length value and the lesser key length value.
7 . The computer-implemented method of claim 1 , wherein calculating the first chunk size for the first string comprises dividing a length of the first string by a number of zero-bits in the shuffle key, and wherein calculating the second chunk size for the second string comprises dividing a length of the second string by a number of one-bits in the shuffle key.
8 . The computer-implemented method of claim 1 , further comprising:
concatenating, by the computing device, the merged string and the header, wherein providing the merged string and the header comprises providing the merged string and the header together.
9 . The computer-implemented method of claim 1 , wherein providing the merged string and the header comprises providing the merged string and the header separately.
10 . The computer-implemented method of claim 1 , wherein the shuffle key length and the compressed key length are stored in a fixed length portion of the header, and the shuffle key is stored in a variable length portion of the header.
11 . The computer-implemented method of claim 1 , further comprising:
receiving, by the another computing device, the merged string and the header; and
unmerging, by the another computing device, the first string and the second string.
12 . The computer-implemented method of claim 11 , wherein unmerging the first string and the second string comprises:
unpacking the header to determine the compressed string length, the shuffle key length, and the shuffle key;
based on the compressed string length, calculating the length of the first string and the length of the second string;
based on the length of the first string, calculating the first chunk size for the first string;
based on the length of the second string, calculating the second chunk size for the second string; and
extracting the first string and the second string from the merged string using the shuffle key.
13 . A computer-implemented method for encoding data values into random strings of data, the method comprising:
receiving, by a computing device, a set of parameter values comprising (i) an alphabet that includes a set of characters, (ii) a target bit width, (iii) a permutation ratio, and (iv) an initial offset value;
based on a size of the alphabet, calculating, by the computing device, a maximum string length of a string created from the alphabet that is uniquely represented by a number having the target bit width;
based on the size of the alphabet, the maximum string length, and the permutation ratio, calculating, by the computing device, a partition size that represents a number of unique stealthy string types that are creatable;
based on the size of the alphabet, the maximum string length, and the partition size, calculating, by the computing device, a number of different possible representations for a given stealthy string type;
arbitrarily selecting, by the computing device, an offset value that represents the given stealthy string type, wherein the offset value falls within a range from zero to the partition size;
generating, by the computing device, a stealthy string of the given stealthy string type, by (i) selecting a random value that falls within a range from zero to the number of different possible representations for the given stealthy string type, (ii) calculating a numeric representation of the stealthy string, based on the random value, the number of different possible representation for the given stealthy string type, and the offset value, (iii) for each digit of the numeric representation of the stealthy string, using the digit as an index value to identify a corresponding character in the alphabet, and (iv) concatenating the corresponding characters.
14 . The computer-implemented method of claim 13 , wherein the given stealthy string type represents a directory name, a file name, an encryption key, or a signature.
15 . The computer-implemented method of claim 13 , wherein the alphabet includes sixty-two alphanumeric characters, including twenty-six lower-case letters, twenty-six upper-case letters, and ten digits.
16 . The computer-implemented method of claim 13 , wherein the target bit width is eight bytes.
17 . The computer-implemented method of claim 13 , wherein calculating the numeric representation of the stealthy string comprises:
determining a product of the random value and the number of different possible representations for the given unique stealthy string type;
determining an intermediate numeric representation of the stealthy string by adjusting the product by the offset value; and
converting the intermediate numeric representation to a base value that corresponds to the size of the alphabet.
18 . The computer-implemented method of claim 13 , further comprising:
receiving, by the computing device and from another computing device, a test string;
determining, by the computing device, whether the test string is of the given stealthy string type; and
outputting, by the computing device, an indication of whether the test string is of the given stealthy string type.
19 . The computer-implemented method of claim 18 , wherein determining whether the test string is of the given stealthy string type comprises:
determining a base value representation of the test string according to a base value that corresponds to the size of the alphabet;
converting the base value representation of the test string to a decimal value representation of the test string;
determining a test value for the test string, by adjusting the decimal value representation of the test string by the offset value, and performing a modulus operation with the partition size; and
comparing the test value for the test string to the offset value that represents the given stealthy string type.