Optimization Algorithms Combining (Meta)heuristics and Mathematical Programming and Its Application in Engineering
View this Special IssueResearch Article  Open Access
Gangqiang Xiong, Shengqian Zheng, Jiang Wang, Zhanchuan Cai, Dongxu Qi, "Local Negative Base Transform and Image Scrambling", Mathematical Problems in Engineering, vol. 2018, Article ID 8087958, 18 pages, 2018. https://doi.org/10.1155/2018/8087958
Local Negative Base Transform and Image Scrambling
Abstract
Scrambling transform is an important tool for image encryption and hiding. A new class of scrambling algorithms is obtained by exploiting negative integer as the base of number representation to express the natural numbers. Unlike Arnold transform, the proposed scrambling transform is onedimensional and nonlinear, and an image can be shuffled by using the proposed transform to rearrange the rows and columns of the image separately or to permute the pixels of the image after scanned into a sequence of pixels; it can be also applied to shuffle certain part region of an image. Firstly, the transformation algorithm for converting nonnegative integers in base to the corresponding integers in base is given in this paper, which is the computational core of scrambling transform and the basis of studying scrambling transform. Then, the three kinds of transforms are introduced, that is, negative base transform (abbreviated as NBT), modular negative base transform (MNBT), and local negative base transform (LNBT) with three parameters, where NBT is an injection and MNBT a surjection and LNBT a bijection. The minimum transform periods of LNBT are calculated for some different values of the three parameters, and the algorithm for calculating the inverse transform of LNBT is given. The image scrambled by LBNT can be recovered by the transform period or the inverse transform. Numerical experiments show that LNBT is an efficient scrambling transform and a strong operation of confusing gray values of pixels in the application of image encryption. Therefore, the proposed transform is a novel tool for information hiding and encryption of twodimensional image and onedimensional audio.
1. Introduction
Because of the properties of visibility, intuitive, abundance in information expression and so on, digital images are widely applied in more and more fields such as remote sensing and geographical information, medical image, audiovisual art, radar navigation, copyright, and trademark; therefore, secure transmission and confidential storage of digital images have been gotten more and more attention by government, industry, and academia. Security protection of digital image includes mainly data encryption and information hiding. Image scrambling is a technique of image encryption or auxiliary encryption [1–9], and also an important method of preprocessing and postprocessing in image hiding, sharing, and digital watermarking [7, 10–17]. Particularly in the application of robust digital watermark, scrambling technique is a very effective method against cropping attack by shuffling watermark image so that the pixels are dispersed in the position space of carrier image. The popular image scrambling methods include Arnold transform [1–3, 10–12, 18], Fibonacci transform [7, 10, 13, 14], PeanoHilbert space filling curve [19], knight's tour [8, 20], Lucas transform [16], magic square transform [9, 17], Gray code [21, 22], cellular automata [15, 23–25], Baker map [4–6, 26], subaffine transform [27], and sampling technology [28].
Most of image scrambling transforms are twodimensional, such as Arnold transform, baker map, PeanoHilbert curve, John Conway game, knight's tour, magic square transform, and FibonacciQ transform [10]. For twodimensional scrambling transforms, the popular scrambling transform is Arnold transform, but it requires the sizes of images are the form of [10]; FibonacciQ transform is the special case of Arnold transforms [10]. Unlike Arnold transform, knight’s tour [8] and PeanoHilbert curve [19], John Conway game [15], and magic square transform [9] are not easy to calculate and are rarely used in the application of image scrambling. In general, if using John Conway game to shuffle images we first need to generate a random matrix of 0 and 1, and thus there are difficulties to restore scrambled images. In fact, Baker map is usually exploited to generate chaotic sequence on the interval [4], and if using baker map to shuffle images we must modify the formula of baker map.
Onedimensional scrambling transform can also be used in twodimensional image encryption and information hiding. Battisti used Fibonacci transform to construct FibonacciHaar matrix and then studied digital watermarking and encryption algorithms in FibonacciHaar domain [7], while Li and Tsai exploited Fibonacci transform to shuffle watermark information [13, 14]. Gunjal combined Fibonacci transform with Lucas transform to construct FibonacciLucas transform which is applied to shuffle watermark image [16]. Zou investigated a class of generalized Gray code and applied it to scramble color image. Twodimensional scrambling transform or higherdimensional scrambling transform [10] generally require that the shape of the region of scrambled image must be rectangular (i.e., the size of ) or even square such as Arnold transform. Onedimensional scrambling transform can not only permute a sequence of data, but also permute the pixels in an image region of any shape. In fact, as long as the pixels in the image region are scanned into a sequence in accordance with certain rule, we can exploit onedimensional scrambling transform to permute these pixels.
In this paper, we use negative number as the base of numeral system to represent the natural numbers and then define negative base transform (abbreviated as NBT) with respect to radix ; construct modular negative base transform (abbreviated as MNBT) with respect to radix ; and modulo followed by constructing local negative base transform (abbreviated as LNBT) whose radix is and modulo and shift , where is an integer greater than 1 and , are natural numbers. In particular, LNBT is a bijective map from the subset of natural numbers to the subset itself. Since LNBT is onedimensional and nonlinear, we can use it to shuffle onedimensional audio signal and also to shuffle twodimensional image. The rest of the paper is organized as follows. Section 2 studies the conversion rules and conversion algorithms from base integers to the corresponding base integers, which is the key of calculating NBT, MNBT, and LNBT. Section 3 gives the definitions of NBT, MNBT, and LNBT and then studies their properties and inverse transforms and last calculates the minimum transformation period of LNBT for some parameter values. Section 4 verifies the scrambling effect of LNBT by simulation experiments, which includes three kinds of scrambling algorithms: scrambling separately along x and ydirection, scrambling a sequence of pixels after image scanned to a sequence linebyline or scanned in zigzag order, and then tests the effect against cropping attack in digital watermarking application and the effect of image encryption by shuffling the binary bits of image pixels. Section 5 analyzes the scrambling effect and compares it with other scrambling algorithms; finally, the conclusion is given.
2. Using Negative Base to Express Nonnegative Integers
2.1. Principle of Number Representation with Negative Base
If selecting a negative integer () as the base of number representation, we only need figures to express all nonnegative integers, that is, we can use the symbols to express all nonnegative integers [29]. In this paper, for convenience, the notation is used to denote an digit integer in base , where is an integer of absolute value greater than 1, and , . For the convenience of description, we also call the th digit of . The rest of this paper, we always suppose is an integer greater than 1. Next, we shall discuss the calculation for conversion from nonnegative integers in base to integers in base .
2.2. Conversion Calculation from Base B Integer to Base −B Integer
Assuming that is an integer greater than 1, a base integer can be converted directly to the corresponding decimal integer expressed by the sum of the product which the th power of is multiplied by the th digit value, as do a base integer to decimal integer, namely,The method of seeking remainder can achieve the conversion from decimal integers to base integers [29]. Next, we shall investigate the algorithm for converting base integers to base integers. Although we can apply the method in [29] to convert successfully base integers to base integers after the base integers being converted to decimal integers, we still need to investigate the method of straightforward conversion of base integers to base integers. There are two main reasons. First, Theorem 7 needs to use the conclusion of Theorem 1, that is, we need to get the relation of the digit capacities between any base integer and the corresponding base integer. Second, sometimes we need to convert base integers directly to base integers. The proposed algorithm can achieve simply the conversion from base integers to base integers; especially the conversion method from binary integers to negabinary integers is simpler. We will consider the issue of the digit capacity of the base integer converted from a known base integer, that is, there is Theorem 1 as follows.
Theorem 1. Suppose is a positive integer in base to be converted, where , while is the converted integer in base , where , then .
Proof. First, holds obviously, followed by must be even, since if is odd, which contradicts .
Next, we prove is not greater than . Denoted by the minimum of digits integers in base for all satisfying . It is obvious that the value of the positive integer as expressed by is smallest only if , , , and there isAssume , i.e., , since , we have, from (2)The above inequality shows that cannot be converted to such a base integer of digit capacity greater than .
Theorem 1 shows that can be converted to a base integer with ()digit at most, that is, when be converted, there may be carries from the nth digit place to the th digit place or the th digit place, but not to the th digit place. To be more exact, there is the following Corollary 2.
Corollary 2. Suppose . If is even, then can be converted to the forms of or ; if is odd, then can be only converted to the form of .
Proof. It is obvious that cannot be converted to the form of such that . Then according to Theorem 1, can be only converted to three forms as follows:If is even, it is clear that the form of (6) is likely to appear, for example, if , (), there is , () after converted to the corresponding integer in base . On the other hand, if taking , , (), there is , , , , (); this indicates that can be possibly converted to the form of (4). Since it can be deduced from that , the form of (5) cannot occur.
If is odd, it is clear that cannot converted to the forms of (4) and (6); otherwise, there is . So is only converted to the form of (5).
When an integer in base is converted to the corresponding integer in base , we suppose the conversion process is from right to left digitbydigit. Then Corollary 2 shows that, when being converted, there may be two carries need to be carried to the th digit place and the th digit place if is even; otherwise, there is only a carry to the th digit place. From Corollary 2, we can get the following conversion rules, namely, Corollary 3.
Corollary 3 (conversion rules of base integer to base integer). Suppose is a base integer that needs to be converted, where , and is the converted base integer, where and are likely to be zeros. Let be a sequence of carries in the process of conversion, and initial values (). Then, in accordance with the following rules, base integer can be correctly converted to the corresponding base integer.
(i) When is even, if , then , , ; otherwise, .
(ii) When is odd, if , then ; otherwise, , .
The left arrow “” in the above denotes that the value of the expression on the right side is assigned to the variable on the left side. In the following, we shall prove that Corollary 3, in fact, only proves that the converted integer in base is equal to the original base integer.
Proof. If is even and , there isCorollary 2 indicates , and from , we have , i.e., . Corollary 2 tells us again that, when is converted, there is only a carry from the th digit place to the kth digit place, and when is converted, there are two carries at most from the digit place to the th digit place and the th digit place. That is to say, when being converted, the initial values . Therefore, it follows from (7) that , . If , obviously, there isi.e., .
If is odd and , then , and the inequality indicates that is true. If , we haveThe inequality and (9) imply that and there is a carry 1 from the current digit place to the th digit place. In addition, it can be known from Corollary 2 that, when being converted, maybe there exist two carries from the th digit place to the th digit place and the th digit place, namely, may not be equal to 0 when being converted. Therefore, need to accumulate the carry 1, i.e., is true.
So we can obtain Algorithm 1 from Corollary 3.

For binary, the conversion process is more concise, and the specific conversion rules are described in the following Corollary 4.
Corollary 4 (conversion rules of binary positive integers to negabinary integers). Suppose is a binary positive integer to be converted, where ; is the converted negabinary integer, and the initial values for . Then the following conversion rules hold.
(i) When is odd and , if , then , ; otherwise .
(ii) When is even and , if , then ; otherwise , , .
(iii) If , then the value of keeps changeless.
3. Scrambling Transform Based on Negative Base
Image scrambling, which can change a certain image into another meaningless image, is a special transform from a subset of natural numbers to the subset itself. Rearranging the position of the pixels in the position space of image by permutation on a finite set of the natural numbers can achieve the purpose of scrambling image, such as Arnold transform, baker map, and knight’s tour. Next, we define a new class of scrambling transforms based on the principle of number representation in negative bases.
3.1. Negative Base Transform
Unlike the common image scrambling transform, the scrambling transform studied in this paper is onedimensional, which is such a transform of a certain subset of the natural numbers to the subset itself. First, we define negative base transform in the following.
Definition 5 (negative base transform). For any , if transform satisfiesthen is referred to as negative base transform with respect to base , abbreviated as NBT, and is called transformation parameter of NBT, where is the digit place of the converted integer in base corresponding to .
From Definition 5, we know that, for computing , the natural number must be converted to the form of , and then calculate . For example, since , then . Table 1 gives the values of NBT with parameter of the natural numbers from 0 to 15. According to Table 1, we can know that, after the natural numbers between 0 and 15 is transformed by NBT, the order of the transform is already different from the original order of independent variable, and some of are no longer in the set , e.g., .

3.2. Modular Negative Base Transform
Assume denote a subset of the natural numbers from to , where , , and denotes the set of natural numbers. In general, Image scrambling transform is a bijective map from a finite set to . Unfortunately, NBT is an injective map from the set of natural numbers to itself, but not surjective, and cannot be used directly in application of image scrambling. Hence we shall make some modifications for NBT so that the modified transform is a bijective map from to . According to the transform NBT, we shall introduce another new transform from to as follows.
Definition 6 (modular negative base transform). For , if transform satisfiesthen transform is called modular negative base transform with respect to base and modulo , abbreviated as MNBT, where is an integer greater than 0.
Obviously, MNBT is a surjection from to , but not an injection. In order to make MNBT a bijection, it is necessary to restrict the definition domain of MNBT such that Theorem 7 is true in the following.
Theorem 7. If the definition domain of MNBT is , then MNBT is a bijective map from to .
Proof. Suppose is an MNBT as defined in (11). In fact, we only need to prove that is injective if , that is, prove thatSince any integer in can only be expressed as a digit integer in base at most, it follows from Theorem 1 that and only are represented as a digit integer in base at most. Without loss of generality, we expressed and as digit integers in base ; if the number of digits is not enough, we fill 0 in front of them, that is,where for and , is possibly equal to 0. Let Assume is not an injection; there is such that , namely, . Therefore, we can infer thatSince implies , then there must beIf we can prove that (16) is not true, the fact that is an injective map is proven, i.e., we complete the proof of the theorem.
In accordance with (15), there isIf , then, from (17), there isThis contradicts obviously ; thus this shows .
If , then, from (17) and , there isThis also contradicts and shows that is not true. Therefore we have already completed the proof of Theorem 7.
It is noteworthy that MNBT is a bijective map from to , but not from to the set itself. If taking , then MNBT is a bijective map from to , but in this case, MNBT will map some points to themselves, i.e., the transformation periods of these points are 1, for example, . Thus MNBT cannot be used directly in the application of image scrambling and need to be modified further. In fact, combining MNBT with translational transform with respect to shift , we can obtain a permutation from to , which is of course a bijective map.
3.3. Local Negative Base Transform
Local negative base transform can be constructed by combining MNBT with a translational transform with shift .
Definition 8 (local negative base transform). If the map satisfiesthen is called local negative base transform with respect to base , modulo , and shift , abbreviated as LNBT.
In Definition 8, is also referred to as LNBT with parameter . Obviously, if , LNBT is simplified as MNBT. The following corollary is easily established in accordance with Theorem 7.
Corollary 9. LNBT is a bijective map from to , i.e., LNBT is a permutation on .
Corollary 9 shows that LNBT is a scrambling transform from to itself. Next, we describe the calculation method of LNBT, shown as the Algorithm 2.

For example, if we take , we can calculate easily the values of LNBT according to Algorithm 2, and the calculated results as shown in Table 2, where in Table 2 is defined as (20).

It is obvious that scrambling transform LNBT can map the subset of to ; moreover, LNBT can map (scatter) uniformly the entries of the subset to the set after many times of LNBT. Figure 1 is the result after 19 times of permutation by LNBT, and it can be seen that the black pixels have been scattered uniformly onto the entire position space of the images; especially, the effect is better in the case of implementing transformation after the image is scanned into onedimensional sequence (the form of row vector). Generally, as long as is even and is large enough, the scrambling effect is very good. When the pixels are permuted along xdirection, the positional relationship between adjacent pixels at ydirection cannot be changed. Likewise, when permuting the pixels along ydirection, the positional relationship between adjacent pixels at xdirection cannot be changed. Therefore, the pixels shuffled along x and ydirections separately will result in the black pixels aligned, as shown in Figures 1(b) and 1(f).
(a)
(b)
(c)
(d)
(e)
(f)
(g)
(h)
3.4. Minimum Transformation Period and Inverse Transformation
In the application of digital watermarking and image encryption, it is often necessary to restore the scrambled image. There are two kinds of methods for restoring scrambled image, that is, by inverse scrambling transform and by minimum transformation period.
3.4.1. Minimum Transformation Period
Like Arnold transform, MNBT and LNBT exist transformation periods, as shown in Theorem 10. In Theorem 10, we use the notations and , which are defined bywhere and as defined by (11) and (20).
Theorem 10 (period existence theorem for LNBT and MNBT). There exists a positive integer such that for any and a positive integer such that for any .
Proof. We only prove that exists the transformation period and can also use the same method to prove . Since the number of entries in the set is finite, we only prove that, for any , there is such that ; in fact, the transform period of is the common multiple of all .
Suppose for any positive integer there is such that . Let , for any positive integer , we have, from the fact that is bijective,On the other hand, let , , from and pigeonhole principle; we know that there is such that . Without loss of generality, assume , then from the fact that is a bijective map and , we can conclude , namely, . This contradicts (22). Therefore, there must exist a positive integer such that . The proof of this theorem has already completed.
If using the periodicity of scrambling transform to restore scrambled image, we must find the minimum transformation period of LNBT, but Theorem 10 does not give a calculation method of the minimum transform period. In general, it is not easy to determine the minimum transform period of MNBT and LNBT. Table 3 is the minimum transform periods of MNBT and LNBT withfor . For example, for , the minimum transformation periods of all entries on are 3 and 6, respectively. Then the minimum transformation period of LNBT with parameter is 6 as shown Table 3.

Looking at Table 3, we can get the conclusion as shown in Proposition 11.
Proposition 11. The set is the definition domain of LNBT, where is nonnegative. For different and , there is the following conclusion.
(i) The minimum transformation periods of LNBT are not greater than . If B=2,4,8 and is odd, or is even and , the minimum transformation periods of LNBT is equal to .
(ii) If is even, the difference between and the minimum transformation period is bigger.
(iii) If is odd, the difference between and the minimum transformation period is also bigger.
Conclusion (i) in Proposition 11 is very important, and in the application of image scrambling, we often take as an even number and as an odd number; especially, take and . In general, the effect is better if the difference between and the minimum transformation period is smaller. In fact, is often a transformation period of LNBT with parameter , but is not necessarily the minimum transformation period. For example, LNBT with parameter is a cycle on the set , namely, , and this shows that the minimum transformation period of LNBT with parameter is equal to 8. Figure 2 is the experimental results by using minimum transformation period to restore scrambled image, where the parameter values are in (b) and (c).
(a)
(b)
(c)
3.4.2. Inverse Transforms of MNBT and LNBT
It is not easy to compute the minimum transformation period of MNBT and LNBT for different parameters ; on the other hand, although the minimum transformation period is sometimes known, but the minimum transformation period is possibly large, so that the computational complexity of restoring scrambled image becomes large. For example, if we use LNBT with parameters to shuffle the pixels of an image of size after scanned into a sequence, then the minimum transformation period is 262144. Therefore, the calculation is sometimes difficult by using the periodicity of LNBT to restore scrambled image, while the calculation of restoring scrambled image is more concise and faster by inverse transform of LNBT.
Let ; (10) implies , i.e., and . Thus, from (10), the inverse map of NBT is obtained directly, namely,and satisfies the condition . Equation (24) tells us the process of calculation, which convert to an integer in base and then calculate the expression of right side in (24).
Suppose the definition domain of MNBT is . Next, we consider the calculation for the inverse map of . According to Theorem 1 and (11), we can conclude that there exists a nonnegative integer such that . From (24), we can get the inverse map of MNBT, namely,where satisfies . In order to compute in (25), we must first determine the value of . In fact, the selected must make the calculated from (25) satisfy , and from the fact that MNBT is permutation on , we know that is uniquely determined.
From (25) and (20), we can get the inverse map of LNBT, namely,Therefore, the inverse transform can be calculated from (26), (27), and (28), and the specific details are depicted as Algorithm 3.

Figure 3 is the experimental results of image scrambled by LNBT and image restored by inverse LNBT, where the parameter is and the size of image is 512×512. Image (b) is the scrambled image by 19 times of LNBT along x and ydirection separately and image (c) is the restored image by 19 times of inverse transform of LNBT.
(a)
(b)
(c)
4. Experiments of Image Scrambling
4.1. Scrambling along X and YDirection Separately
Unlike Arnold transform, LNBT is a bijective map from the definition domain to definition domain itself, and if using LNBT to shuffle twodimension image, we can permute the pixels of image along x and ydirection. Selection of parameter is relation to the size of image to be scrambled; suppose the size of image is , we should select at ydirection and at xdirection and take as an odd number. For example, Figure 4(a) is an image of size 216×256; then we can select the parameter at xdirection and at ydirection. Figure 4(e) is another image of size 256×256; then we can select the same parameter both x and ydirection. From Figure 4, we find that the scrambled pixels are aligned along x and ydirection, respectively.
(a)
(b)
(c)
(d)
(e)
(f)
(g)
(h)
4.2. Scrambling after Scanned into a Sequence
(i) Scan LinebyLine. In order to eliminate the alignment phenomenon of pixels as described above after image was scrambled along x and ydirection separately, the easiest method is that we use LNBT to permute the sequence of pixels after twodimensional image is scanned into a onedimensional sequence linebyline. Figure 5(a) is an image of size 216×216, and after being scanned into a onedimensional vector, the length of the corresponding onedimension vector is ; thus we select the parameter to shuffle the pixels. Figure 5(e) is another image of size 256×256, and we can select the parameter to shuffle the pixels after being scanned into a onedimension vector. From Figures 4 and 5, we find that the smaller the parameter B is, the better the scrambling effect is.
(a)
(b)
(c)
(d)
(e)
(f)
(g)
(h)
(2) Scan in Zigzag Order. After scanning a twodimension image into a sequence of pixels linebyline, if taking we can obtain a good scrambling result by many times of LNBT, as shown in Figure 5(h), but if selecting , the scrambling effect is not very good. In Figure 6, we first use the zigzag scan technique to change a twodimension image into the corresponding onedimension vector and then use LNBT to permute this sequence of pixels; last, we use the same zigzag order to arrange the scrambled sequence and obtain the corresponding scrambled image. Compared with Figure 5, we find the effect of image scrambling becomes better in Figure 6.
(a)
(b)
(c)
(d)
(e)
(f)
(g)<