1 Introduction

There are numerous environments in everyday existence, when the secret contents conveyed over apprehensive line of communication. Most of the outmoded cryptosystems are utilized in literature to accomplish the security of confidential information [1]. Digital contents are transferred over communication medium, such as documents, advertisements and law enforcement constituents very extensively and security of information is vibrant issue. Due to thoughtful events of hackers, these contents can easily end up in the hands of unauthorized individuals. They can excerpt or alter the data without knowledge of appropriate receiver [2]. The research is going over the years in information theory and cryptology to offer the protection for digital contents. The vibrant issue in line of communication to shelter the privacy of appropriate users [3,4,5,6,7,8,9,10,11,12,13,14,15,16,17].

Modern ages of cryptography point out around 1950’s, when Claude Shannon produced an article ‘A mathematical theory of cryptography’ published in the Bell System Technical Journal in 1949 [18]. He was inspired during the World War II, when electromechanical cipher machines used very widely. He then identified the two main goals of cryptography: Confidentiality and Authenticity and wrote an article “A mathematical theory of communication” which highlights one of the most significant aspects of cryptography’s importance [19].

Different algorithms proposed in different times and DES of 56-bit long key approved and adopted by US agencies and considered to be secure, but improvements in technology have made it trivial to defeat. Although DES replaced by AES, but the fact is if powerful computers may crack DES in few hours, the area of risk in public key cryptography vulnerable to the future developments. This uncertainty provides potential threat to perfect security required at national and intellectual property level.

Various schemes produced in different ages to secure the communication in public channels. In this article, we developed a novel structure based on ‘Kramer’s arbitrary spin’ to provide security for digital contents.

In the light of quantum mechanics, Kramer’s theorem states that the time reversal symmetric system with half integer total spin for every energy eigenstate, there is at least one more eigenstate with the same energy. In simple words, each energy level is at least degenerate double if it has half integer spin. If we operate Hamiltonian operator with time reversal, then the time reversed state also act as an eigenstate with the same energy for every energy eigenstate and this state might be identical to the original state. In half integer spin systems, it reverses all angular momenta and cannot produce the same state as the magnetic quantum number can never be zero. The energy levels for a system with odd numbers of fermions, such as electrons, protons and neutrons, at least degenerate double in the presence purely electric field [20].

This article is organized in 5 sections. The preliminaries of this article including derivations presented in section 2. The proposed cryptosystem and its implementation on standard images followed in section 3. Experimentation and performance analyses for the proposed scheme conveyed in section 4 and section 5 comprises the concluding remarks.

2 Basic Terminologies

This section demonstrates the fundamental concepts of orthogonal codes, Redheffer codes and the derivations of Kramer’s arbitrary spin matrices.

2.1 Orthogonal Codes

Orthogonal codes introduced by Jacques Hadamard in 1893 and has a remarkable attention in coding theory. Code word set Hkcan be constructed in dimension of 2k × 2kand can also be entitled as Hadamard matrix. k-bit data set from Hk − 1 matrix as follows [21]:

$$ {H}_k=\left[\begin{array}{cc}{H}_{k-1}& {H}_{k-1}\\ {}{H}_{k-1}& \overline{H_{k-1}}\end{array}\right] $$
(1)

One-bit data set can be encoded by using orthogonal code words of 2 digits each, described by the rows of matrix and the 2-bit data set can be transformed by extending the one-bit set both horizontally and vertically given as follows [21]:

2.2 Bi-Orthogonal Codes

Bi-Orthogonal set of total code words ‘M’ can be obtained from orthogonal set of code words M/2 by supplementing it with negative of each as follows [21]:

$$ {B}_k=\left[\begin{array}{c}{H}_{k-1}\\ {}\overline{H_{k-1}}\end{array}\right]. $$
(2)

2.3 Redheffer Matrices

A Redheffer matrix is n × n square (0,1) matrix with elements ai j = 1, if j = 1  or  i ∣ j  (i divides j) and 0 otherwise. For n = 1, 2, ..., k, the first few matrices are:

$$ \left[1\right],\left[\begin{array}{cc}1& 1\\ {}1& 1\end{array}\right],\left[\begin{array}{ccc}1& 1& 1\\ {}1& 1& 0\\ {}1& 0& 1\end{array}\right],\left[\begin{array}{cccc}1& 1& 1& 1\\ {}1& 1& 0& 1\\ {}1& 0& 1& 0\\ {}1& 0& 0& 1\end{array}\right],\left[\begin{array}{ccccc}1& 1& 1& 1& 1\\ {}1& 1& 0& 1& 0\\ {}1& 0& 1& 0& 0\\ {}1& 0& 0& 1& 0\\ {}1& 0& 0& 0& 1\end{array}\right],.... $$

Determinant of n × nmatrix equal to Mertens function M(n) [22]. For n = 1, 2, 3, …, first few values for the function are 1, 0, −1, −1, −2, −1, −2, −2, …. Eigenvalues of n × nRedheffer matrix for n > 1 equals to a(n) = n − ⌊lgn⌋ − 1 [23].

2.4 Kramer’s Spin Matrices

Kramer’s method gives high degree of naturalness. Let us introduce 2 spinor components u  and  v, i.e. \( \xi =\left(\begin{array}{c}u\\ {}v\end{array}\right)\kern0.37em \mathrm{is}\ \mathrm{a}\ \mathrm{complex}\ \mathrm{vector}\ \mathrm{by}\ \mathrm{nature} \) [24]. The spinor components in Euclidean space represented as:

$$ \left(\begin{array}{c}U\\ {}V\end{array}\right)=\left(\begin{array}{cc}\alpha & \beta \\ {}-{\beta}^{\ast }& {\alpha}^{\ast}\end{array}\right)\left(\begin{array}{c}u\\ {}v\end{array}\right), $$
(3)

where UU + VV = uu + vv, \( u=\sqrt{a_1-i{a}_2} \), \( v=i\sqrt{a_1+i{a}_2} \)and α = cos θ + i k3 sin θ, β = (k2 + i k1) sin θ assign as rotational interpretations in Euclidean space. These are so called Cayley-Klein parameters [25].

By applying Kramer’s method on Eq. (3), the result as follows:

$$ \left(\begin{array}{c} UU\\ {} UV\\ {} VV\end{array}\right)=\left(\begin{array}{c}\left(\alpha u+\beta v\right)\left(\alpha u+\beta v\right)\\ {}\left(\alpha u+\beta v\right)\left(-{\beta}^{\ast }u+{\alpha}^{\ast }v\right)\\ {}\left(-{\beta}^{\ast }u+{\alpha}^{\ast }v\right)\left(-{\beta}^{\ast }u+{\alpha}^{\ast }v\right)\end{array}\right)=\left(\begin{array}{ccc}{\alpha}^2& 2\alpha \beta & {\beta}^2\\ {}-\alpha {\beta}^{\ast }& \alpha {\alpha}^{\ast }-\beta {\beta}^{\ast }& \beta {\alpha}^{\ast}\\ {}{\left({\beta}^{\ast}\right)}^2& -2{\alpha}^{\ast }{\beta}^{\ast }& {\left({\alpha}^{\ast}\right)}^2\end{array}\right)\left(\begin{array}{c} uu\\ {} uv\\ {} vv\end{array}\right). $$
(4)

Since in this case, \( {\alpha}_1^2+{\alpha}_2^2+{\alpha}_3^2=0, \) which implies

$$ {\alpha}_3=\pm i\sqrt{\left({\alpha}_1+i{\alpha}_2\right)\left({\alpha}_1-i{\alpha}_2\right)}. $$
(5)

From the results of u, v and Eq. (5), we have

$$ {\alpha}_1=\frac{1}{2}\left({u}^2-{v}^2\right),\kern0.5em {\alpha}_2=i\frac{1}{2}\left({u}^2+{v}^2\right),\kern0.5em {\alpha}_3=-i\; uv. $$

2.4.1 Spin S (1)

By using Eq. (4) to develop S (1) as follows:

$$ S(1)=\left(\begin{array}{ccc}{\alpha}^2& \sqrt{2}\alpha \beta & {\beta}^2\\ {}-\sqrt{2}\alpha {\beta}^{\ast }& \alpha {\alpha}^{\ast }-\beta {\beta}^{\ast }& \sqrt{2}\beta {\alpha}^{\ast}\\ {}{\left({\beta}^{\ast}\right)}^2& -\sqrt{2}{\alpha}^{\ast }{\beta}^{\ast }& {\left({\alpha}^{\ast}\right)}^2\end{array}\right) $$
(6)

Extract the matrices σ from Eq. (6) with respect to the results of α1, α2 and α3. The matrices are given as:

$$ {\sigma}_x=\left(\begin{array}{ccc}0& +\sqrt{2}& 0\\ {}\sqrt{2}& 0& +\sqrt{2}\\ {}0& \sqrt{2}& 0\end{array}\right),\kern0.5em {\sigma}_y=i\left(\begin{array}{ccc}0& -\sqrt{2}& 0\\ {}\sqrt{2}& 0& -\sqrt{2}\\ {}0& \sqrt{2}& 0\end{array}\right),\kern0.5em {\sigma}_z=\left(\begin{array}{ccc}2& 0& 0\\ {}0& 0& 0\\ {}0& 0& -2\end{array}\right). $$

These 3 × 3 matrices σi, j are manifestly traceless hermitian. They are, unlike the Pauli’s matrices, not closed under multiplication, but closed under commutation [24]. The case is unitary and unimodular, St(1) S(1) = I  and  det S(1) = 1.In Pauli’s ½ spin case, \( {\sigma}_x^2+{\sigma}_y^2+{\sigma}_z^2=3\;I, \) while in the above case of Kramer spin \( {\sigma}_x^2+{\sigma}_y^2+{\sigma}_z^2=8\;I \). From the above results, we can calculate (2 l + 1) dimension traceless hermitian tuples.

$$ S(l)=\left\{{\sigma}_x(l),{\sigma}_y(l),{\sigma}_z(l)\right\},\mathrm{for}\kern0.5em l=3/2,2,5/2,.... $$

2.4.2 Spin S (3/2)

By applying Kramer’s method for S (3/2) on Eq. (3), the result as follows:

$$ {\displaystyle \begin{array}{l}\left(\begin{array}{c} UUU\\ {} UUV\\ {} UVV\\ {} VVV\end{array}\right)=\left(\begin{array}{cccc}{\alpha}^3& 3{\alpha}^2\beta & 3\alpha {\beta}^2& {\beta}^3\\ {}-{\alpha}^2{\beta}^{\ast }& {\alpha}^2{\alpha}^{\ast }-2\alpha \beta {\beta}^{\ast }& 2\alpha {\alpha}^{\ast}\beta -{\beta}^2{\beta}^{\ast }& {\alpha}^{\ast }{\beta}^2\\ {}\alpha {\left({\beta}^{\ast}\right)}^2& -2\alpha {\alpha}^{\ast }{\beta}^{\ast }+\beta {\left({\beta}^{\ast}\right)}^2& \alpha {\left({\alpha}^{\ast}\right)}^2-2{\alpha}^{\ast}\beta {\beta}^{\ast }& {\left({\alpha}^{\ast}\right)}^2\beta \\ {}-{\left({\beta}^{\ast}\right)}^3& 3{\alpha}^{\ast }{\left({\beta}^{\ast}\right)}^2& -3{\left({\alpha}^{\ast}\right)}^2{\beta}^{\ast }& {\left({\alpha}^{\ast}\right)}^3\end{array}\right)\left(\begin{array}{c}\mathrm{uuu}\\ {}\mathrm{uuv}\\ {} uvv\\ {} vvv\end{array}\right),\\ {}S\left(3/2\right)=\left(\begin{array}{cccc}{\alpha}^3& \sqrt{3}{\alpha}^2\beta & \sqrt{3}\alpha {\beta}^2& {\beta}^3\\ {}-\sqrt{3}{\alpha}^2{\beta}^{\ast }& {\alpha}^2{\alpha}^{\ast }-2\alpha \beta {\beta}^{\ast }& 2\alpha {\alpha}^{\ast}\beta -{\beta}^2{\beta}^{\ast }& \sqrt{3}{\alpha}^{\ast }{\beta}^2\\ {}\sqrt{3}\alpha {\left({\beta}^{\ast}\right)}^2& -2\alpha {\alpha}^{\ast }{\beta}^{\ast }+\beta {\left({\beta}^{\ast}\right)}^2& \alpha {\left({\alpha}^{\ast}\right)}^2-2{\alpha}^{\ast}\beta {\beta}^{\ast }& \sqrt{3}{\left({\alpha}^{\ast}\right)}^2\beta \\ {}-{\left({\beta}^{\ast}\right)}^3& \sqrt{3}{\alpha}^{\ast }{\left({\beta}^{\ast}\right)}^2& -\sqrt{3}{\left({\alpha}^{\ast}\right)}^2{\beta}^{\ast }& {\left({\alpha}^{\ast}\right)}^3\end{array}\right).\end{array}} $$

The case is unitary and unimodular, St(3/2) S(3/2) = I and det (S(3/2)) = 1.By using values of α and β, we can transform the matrix S (3/2) as follows [26]:

$$ S\left(3/2\right)=\left(\begin{array}{cccc}{\alpha}^3& \sqrt{3}\beta & 0& 0\\ {}-\sqrt{3}{\beta}^{\ast }& {\alpha}^2{\alpha}^{\ast }& 2\beta & 0\\ {}0& -2{\beta}^{\ast }& \alpha {\left({\alpha}^{\ast}\right)}^2& \sqrt{3}\beta \\ {}0& 0& -\sqrt{3}{\beta}^{\ast }& {\left({\alpha}^{\ast}\right)}^3\end{array}\right) $$
(7)

Extract σx, σy and σz from Eq. (7) as follows:

$$ {\sigma}_x=\left(\begin{array}{cccc}0& +\sqrt{3}& 0& 0\\ {}\sqrt{3}& 0& +2& 0\\ {}0& 2& 0& +\sqrt{3}\\ {}0& 0& \sqrt{3}& 0\end{array}\right),\kern0.5em {\sigma}_y=i\left(\begin{array}{cccc}0& -\sqrt{3}& 0& 0\\ {}\sqrt{3}& 0& -2& 0\\ {}0& 2& 0& -\sqrt{3}\\ {}0& 0& \sqrt{3}& 0\end{array}\right),\kern0.5em {\sigma}_z=\left(\begin{array}{cccc}3& 0& 0& 0\\ {}0& 1& 0& 0\\ {}0& 0& -1& 0\\ {}0& 0& 0& -3\end{array}\right), $$

where \( {\sigma}_x^2+{\sigma}_y^2+{\sigma}_z^2=15\;I. \).

2.4.3 Spin S (2)

By applying Kramer’s method on Eq. (3), S (2) is given as:

$$ S(2)=\left(\begin{array}{ccccc}{\alpha}^4& 2\beta & 0& 0& 0\\ {}-2{\beta}^{\ast }& {\alpha}^3{\alpha}^{\ast }& \sqrt{6}\beta & 0& 0\\ {}0& -\sqrt{6}{\beta}^{\ast }& {\alpha}^2{\left({\alpha}^{\ast}\right)}^2& \sqrt{6}\beta & 0\\ {}0& 0& -\sqrt{6}{\beta}^{\ast }& \alpha {\left({\alpha}^{\ast}\right)}^3& 2\beta \\ {}0& 0& 0& -2{\beta}^{\ast }& {\left({\alpha}^{\ast}\right)}^4\end{array}\right) $$
(8)

Extract σx, σy and σz from Eq. (8) as follows:\( {\sigma}_x=\frac{1}{2}\left(\begin{array}{ccccc}0& +2& 0& 0& 0\\ {}2& 0& +\sqrt{6}& 0& 0\\ {}0& \sqrt{6}& 0& +\sqrt{6}& 0\\ {}0& 0& \sqrt{6}& 0& +2\\ {}0& 0& 0& -2& 0\end{array}\right),\kern0.5em {\sigma}_y=i\frac{1}{2}\left(\begin{array}{ccccc}0& -2& 0& 0& 0\\ {}2& 0& -\sqrt{6}& 0& 0\\ {}0& \sqrt{6}& 0& -\sqrt{6}& 0\\ {}0& 0& \sqrt{6}& 0& -2\\ {}0& 0& 0& -2& 0\end{array}\right),\kern0.5em {\sigma}_z=\left(\begin{array}{ccccc}2& 0& 0& 0& 0\\ {}0& 1& 0& 0& 0\\ {}0& 0& 0& 0& 0\\ {}0& 0& 0& -1& 0\\ {}0& 0& 0& 0& -2\end{array}\right), \)where \( {\sigma}_x^2+{\sigma}_y^2+{\sigma}_z^2=6\;I \).

2.4.4 Spin S (5/2)

By applying Kramer’s method on Eq. (3) and extraction of σx, σy and σz from S (5/2) as follows:

$$ {\displaystyle \begin{array}{c}{\sigma}_x=\frac{1}{2}\left(\begin{array}{cccccc}0& +\sqrt{5}& 0& 0& 0& 0\\ {}\sqrt{5}& 0& +\sqrt{8}& 0& 0& 0\\ {}0& \sqrt{8}& 0& +\sqrt{9}& 0& 0\\ {}0& 0& \sqrt{9}& 0& +\sqrt{8}& 0\\ {}0& 0& 0& \sqrt{8}& 0& +\sqrt{5}\\ {}0& 0& 0& 0& \sqrt{5}& 0\end{array}\right),\\ {}{\sigma}_y=i\frac{1}{2}\left(\begin{array}{cccccc}0& -\sqrt{5}& 0& 0& 0& 0\\ {}\sqrt{5}& 0& -\sqrt{8}& 0& 0& 0\\ {}0& \sqrt{8}& 0& -\sqrt{9}& 0& 0\\ {}0& 0& \sqrt{9}& 0& -\sqrt{8}& 0\\ {}0& 0& 0& \sqrt{8}& 0& -\sqrt{5}\\ {}0& 0& 0& 0& \sqrt{5}& 0\end{array}\right),\kern0.5em {\sigma}_z=\left(\begin{array}{cccccc}\frac{5}{2}& 0& 0& 0& 0& 0\\ {}0& \frac{3}{2}& 0& 0& 0& 0\\ {}0& 0& \frac{1}{2}& 0& 0& 0\\ {}0& 0& 0& -\frac{1}{2}& 0& 0\\ {}0& 0& 0& 0& -\frac{3}{2}& 0\\ {}0& 0& 0& 0& 0& -\frac{5}{2}\end{array}\right),\end{array}} $$

where \( {\sigma}_x^2+{\sigma}_y^2+{\sigma}_z^2=\frac{35}{4}I. \).

3 Proposed Algorithm

We develop arbitrary spin matrices by using Kramer’s transformation. In this section, we transformed these matrices to encrypt the data as well as key with the help of Hadamard and Redheffer matrices. Orthogonal or biorthogonal and Redheffer codes use to encrypt the key with respect to key length. Hadamard codes are singular, convert it into nonsingular by taking compliment before encryption. Redheffer matrix of order 2 × 2 and spin (1, 2, 3, ..., n, where n ∈ )matrices cannot be used because of following the singular property, while spin (1/2, 3/2, 5/2, ..., n/2), where n is odd number are nonsingular matrices and can be used to encrypt the data.

3.1 Spin S (1/2)

$$ {\displaystyle \begin{array}{c}I=\left(\begin{array}{cc}1& 0\\ {}0& 1\end{array}\right)=a,\kern0.5em {\sigma}_x=\left(\begin{array}{cc}0& 1\\ {}1& 0\end{array}\right)=b,\\ {}\begin{array}{cc}i\;{\sigma}_y=\left(\begin{array}{cc}0& -1\\ {}1& 0\end{array}\right)=c,& {\sigma}_z=\left(\begin{array}{cc}1& 0\\ {}0& -1\end{array}\right)=d.\end{array}\end{array}} $$

3.2 Spin S (3/2)

$$ {\displaystyle \begin{array}{c}I=\left(\begin{array}{cccc}1& 0& 0& 0\\ {}0& 1& 0& 0\\ {}0& 0& 1& 0\\ {}0& 0& 0& 1\end{array}\right)=a,\kern0.5em {\sigma}_x=\left(\begin{array}{cccc}0& +\sqrt{3}& 0& 0\\ {}\sqrt{3}& 0& +2& 0\\ {}0& 2& 0& +\sqrt{3}\\ {}0& 0& \sqrt{3}& 0\end{array}\right)=b,\\ {}\begin{array}{cc}i{\sigma}_y=\left(\begin{array}{cccc}0& -\sqrt{3}& 0& 0\\ {}\sqrt{3}& 0& -2& 0\\ {}0& 2& 0& -\sqrt{3}\\ {}0& 0& \sqrt{3}& 0\end{array}\right)=c,& {\sigma}_z=\left(\begin{array}{cccc}3& 0& 0& 0\\ {}0& 1& 0& 0\\ {}0& 0& -1& 0\\ {}0& 0& 0& -3\end{array}\right)=d.\end{array}\end{array}} $$

3.3 Spin S (5/2)

$$ {\displaystyle \begin{array}{c}I=\left(\begin{array}{cccccc}1& 0& 0& 0& 0& 0\\ {}0& 1& 0& 0& 0& 0\\ {}0& 0& 1& 0& 0& 0\\ {}0& 0& 0& 1& 0& 0\\ {}0& 0& 0& 0& 1& 0\\ {}0& 0& 0& 0& 0& 1\end{array}\right)=a,\kern0.5em {\sigma}_x=\frac{1}{2}\left(\begin{array}{cccccc}0& +\sqrt{5}& 0& 0& 0& 0\\ {}\sqrt{5}& 0& +\sqrt{8}& 0& 0& 0\\ {}0& \sqrt{8}& 0& +\sqrt{9}& 0& 0\\ {}0& 0& \sqrt{9}& 0& +\sqrt{8}& 0\\ {}0& 0& 0& \sqrt{8}& 0& +\sqrt{5}\\ {}0& 0& 0& 0& \sqrt{5}& 0\end{array}\right)=b,\\ {}\begin{array}{cc}i{\sigma}_y=\frac{1}{2}\left(\begin{array}{cccccc}0& -\sqrt{5}& 0& 0& 0& 0\\ {}\sqrt{5}& 0& -\sqrt{8}& 0& 0& 0\\ {}0& \sqrt{8}& 0& -\sqrt{9}& 0& 0\\ {}0& 0& \sqrt{9}& 0& -\sqrt{8}& 0\\ {}0& 0& 0& \sqrt{8}& 0& -\sqrt{5}\\ {}0& 0& 0& 0& \sqrt{5}& 0\end{array}\right)=c,& {\sigma}_z=\left(\begin{array}{cccccc}\frac{5}{2}& 0& 0& 0& 0& 0\\ {}0& \frac{3}{2}& 0& 0& 0& 0\\ {}0& 0& \frac{1}{2}& 0& 0& 0\\ {}0& 0& 0& -\frac{1}{2}& 0& 0\\ {}0& 0& 0& 0& -\frac{3}{2}& 0\\ {}0& 0& 0& 0& 0& -\frac{5}{2}\end{array}\right)=d.\end{array}\end{array}} $$

Let entangle these n × n matrices to form a set ‘A’ of 2n × 2n matrices [1].

$$ A=\left[{A}_1,{A}_2,{A}_3,...,{A}_{24}\right], where\kern0.24em {A}_1=\left[\begin{array}{cc}a& b\\ {}c& d\end{array}\right],{A}_2=\left[\begin{array}{cc}a& b\\ {}d& c\end{array}\right],...,{A}_{23}=\left[\begin{array}{cc}d& b\\ {}c& a\end{array}\right],{A}_{24}=\left[\begin{array}{cc}d& b\\ {}a& c\end{array}\right]. $$

3.4 Experimentation of Proposed Scheme

We have performed experimentation with key [00110 10,100] on standard images of size 512 × 512. The entangled matrices with respect to key are A6 and A14 and performed experiment on spin systems S (3/2) and S (5/2) respectively.

4 Performance Analyses for Anticipated Structure

Different standard performance analyses accomplished in this section on standard digital contents to assert the performance and security of anticipated algorithm (see Figs. 1, 2 and 3). These outcomes contain the factual investigation, sensibility examination and loophole test for encrypted data. Different analyses discussed in subsection of 4 in detail to examine the sensitivity of offered encryption mechanism.

Fig. 1
figure 1

Proposed encryption strategy

Fig. 2
figure 2

Plain and encrypted layer wise contents of Lena image. (a-d) Plain image and its corresponding layer wise contents, (e-h) Encrypted image and its corresponding layer wise contents at S (3/2), (i-l) encrypted image and its corresponding layer wise contents at S (5/2)

Fig. 3
figure 3

Plain and encrypted layer wise contents of Pepper image. (a-d) Plain image and its corresponding layer wise contents, (e-h) Encrypted image and its corresponding layer wise contents at S (3/2), (i-l) encrypted image and its corresponding layer wise contents at S (5/2)

4.1 Randomness Analyses

With a specific end goal to justify the prerequisites of long period, uniform scattering, high complexity and efficiency for proposed cryptosystem, we execute NIST SP 800–22 analysis to testify the randomness of digital contents [27]. The enciphered Lena image at S (5/2) is employed to accomplish the NIST tests and the aftereffects results presented in Tables 1, 2 and 3.

Table 1 Orthogonal code words set
Table 2 Bi-Orthogonal code words set
Table 3 NIST test results for enciphered Lena image at S (5/2)

By analyzing the outcomes, the anticipated encryption scheme effectively passes all the NIST tests. The production of random ciphers using projected scheme are irregular in the light of accomplished outcomes.

4.2 Uniformity Analyses

Histograms uniformity of enciphered images estimates the security of encryption framework [28]. We have computed the histograms of 256 dark level original and encrypted images of size 512 × 512, that have different contents. The plain image histograms contain sharp upsurges took after sharp decline, while both enciphered images contain uniformity shown in Figs. 4, 5, 6, 7, 8 and 9, which makes statistical attacks tough.

Fig. 4
figure 4

Plain and enciphered layer wise histograms of Lena image. (a-d) Plain image and its corresponding layer wise histograms, (e-h) Encrypted image at S (3/2) and its corresponding layer wise histograms, (i-l) Encrypted image at S (5/2) and its corresponding layer wise histograms

Fig. 5
figure 5

Plain and enciphered layer wise histograms of Pepper image. (a-d) Plain image and its corresponding layer wise histograms, (e-h) Encrypted image at S (3/2) and its corresponding layer wise histograms, (i-l) Encrypted image at S (5/2) and its corresponding layer wise histograms

Fig. 6
figure 6

Three dimensional surface plots for normalized cross-correlation of Lena image. a 3-D surface plot for Lena image, b 3-D surface plot for encrypted Lena image, c 3-D surface plot for cross-correlation between a-b

Fig. 7
figure 7

Three dimensional surface plots for normalized cross-correlation of Pepper image. a 3-D surface plot for Pepper image, b 3-D surface plot for encrypted Pepper image, c 3-D surface plot for cross-correlation between a-b

Fig. 8
figure 8

Correlation between pixels’ pairs for Lena image. (a-c) Correlation of Horizontal, Vertical and Diagonal directions of original image, (d-f) Correlation of Horizontal, Vertical and Diagonal directions of encrypted image at S (3/2), (g-i) Correlation of Horizontal, Vertical and Diagonal directions of encrypted image at S (5/2)

Fig. 9
figure 9

Correlation between pixels’ pairs for Pepper image. (a-c) Correlation of Horizontal, Vertical and Diagonal directions of original image, (d-f) Correlation of Horizontal, Vertical and Diagonal directions of encrypted image at S (3/2), (g-i) Correlation of Horizontal, Vertical and Diagonal directions of encrypted image at S (5/2)

4.3 Pixels’ Correlation Analyses

The neighboring pixels of an image are tremendously associated in horizontal, vertical and diagonal directions. The encrypted data must unrestraint this affiliation to improve the barrier contrary to quantifiable analysis. To testify the association among nearby pixels in plain and enciphered images, 10,000 sets of two nearby pixels from each digital content initially selected [29]. It is demonstrated by the following expression:

$$ {r}_{x,y}=\frac{\sigma_{x,y}}{\sqrt{\sigma_x^2{\sigma}_y^2}}, $$
(9)

where x and y are values of two nearby pixels at gray scale, while σx2 and \( {\sigma}_y^2 \) represents the variances and σx, y is the covariance of random variables x and y.

The coefficients of correlation for plain and encrypted images having dissimilar contents conveyed in Table 4. The association among various couples of original and encrypted images evaluated by calculating the two dimensional correlation coefficients among the original encrypted images [30]. The succeeding calculation is employed to compute the correlation coefficients. The mathematical expression for correlation coefficient is given below:

$$ r=\frac{\sum \limits_{i,j=1}^{M,N}\left({P}_{ij}-\overline{P}\right)\left({C}_{ij}-\overline{C}\right)}{\sqrt{\left(\sum \limits_{i,j=1}^{M,N}{\left({P}_{ij}-\overline{P}\right)}^2\right)\left(\sum \limits_{i,j=1}^{M,N}{\left({C}_{ij}-\overline{C}\right)}^2\right)}}, $$
(10)

where P and C signifies the plain and cipher images, \( \overline{P} \) and \( \overline{C} \)represents the mean values of P and C, M and N demonstrates the height and width of original / cipher images.

Table 4 Plain and enciphered images correlation coefficients at gray scale

The plain and cipher contents are significantly dissimilar from each other as the coefficients of cipher images are very close to zero. The valuation for coefficients of correlation for anticipated design with recent approaches using standard images specified in Tables 5 and 6.

Table 5 Comparisons for coefficients of correlation of proposed scheme with modern approaches
Table 6 Pixels resemblance analyses between plain and enciphered images and comparison with existing approach

The outcomes of our proposed structure have inferior values coefficients, which meet the necessities for competent technique in real time application for enciphering.

4.4 Pixels’ Resemblance Analyses

The resemblance measures primarily reveal the similarity among diverse digital contents. The normalized cross correlation (NCC) and structural contents (SC) values are quite closed to 1 for digital contents structure similarity [29]. There are different types of resemblance coefficient are consumed in order to quantitatively find the structure dissimilarity in digital contents. We have analyzed the structural similarity index, normalized cross correlation and structural content between plain (Pi, j ) and cipher (Ci, j) images in order to estimate the structure dissimilarity among different digital contents from reference. Structural similarity index metric (SSIM) used to compare the assembly, luminance and divergence between original and enciphered images.

$$ SSIM=\frac{\left(2{\mu}_p{\mu}_c+{C}_1\right)\left(2{\sigma}_{pc}+{C}_2\right)}{\left({\mu}_p^2+{\mu}_c^2+{C}_1\right)\left({\sigma}_p^2+{\sigma}_c^2+{C}_2\right)}, $$
(11)

where μp and μc are the mean values,σpc is the standard deviation of Pi, j and Ci, j. The approximation of Eq. 11 approaches 1, if there is any resemblance between plain and cipher images. NCC measures the resemblance and traces of correlation between plain and enciphered images. We perform this test at the original and the encrypted images to analyze the similarity between them.

$$ NCC=\sum \limits_{i=0}^{M-1}\sum \limits_{j=0}^{N-1}\;\frac{P_{i,j}\times {C}_{i,j}}{\sum \limits_{i=0}^{M-1}\sum \limits_{j=0}^{N-1}{P^2}_{i,j}}. $$
(12)

SC determines the structural details and quality of an image in terms of sharpness and noise level. The quality of an image assessed by the following equation and if the value of SC is higher, the quality of an image is poor.

$$ SC=\sum \limits_{i=0}^{M-1}\sum \limits_{j=0}^{N-1}\;\frac{{P^2}_{i,j}}{\sum \limits_{i=0}^{M-1}\sum \limits_{j=0}^{N-1}{C^2}_{i,j}}. $$
(13)

4.5 Pixels’ Discrepancy Analyses

The eminence assessment of an image based on pixels’ discrepancy process analyzed here by evaluating the mean absolute error (MAE), mean square error (MSE) and peak signal to noise ratio (PSNR) [29]. MAE is the most communal method used to measure the accuracy for continues variables. The average absolute difference between original and encrypted images calculated by MAE and its esteem must be greater to enhance the encryption security and defined as:

$$ MAE=\frac{1}{M\times N}\sum \limits_{i=0}^{M-1}\sum \limits_{j=0}^{N-1}\mid {P}_{i,j}-{C}_{i,j}\mid . $$
(14)

Essentially encrypted digital contents have dissimilarity concerning the plain image. Both MSE and PSNR used to relate the image encryption quality, while MSE signifies the cumulative square error measure and PSNR indicates the peak error measurement between the original and ciphered image. By higher the MSE esteem and lower the PSNR values or vice versa signifies the better encryption quality.

$$ MSE=\frac{\sum \limits_{i=1}^M\sum \limits_{j=1}^N{\left({P}_{ij}-{C}_{ij}\right)}^2}{M\times N}, $$
(15)

where Pij and Cij refers the pixels position at ith row and jth column of plain and ciphered images distinctly. Superior the MSE esteem represents the enhancement of encryption strategy [30]. PSNR ratio determines the quality measure between plain and enciphered image described by the succeeding expression:

$$ \mathrm{PSNR}=20{\log}_{10}\left[\frac{I_{MAX}}{\sqrt{MSE}}\right], $$
(16)

where IMAX is the utmost pixel’s estimation of image. On comparing with immense difference between the plain and ciphered images, PSNR should be low esteem. The feasibility of proposed approach assessed for MSE and PSNR for standard digital images presented in Table 7.

Table 7 Pixels’ discrepancy analyses between plain and enciphered images and comparison with existing approach

4.6 Entropy Analyses

The leading feature for specifying the randomness quantified by Entropy. Specified an independent source of random trials from set of probable distinct trials {x1, x2, x3, ..., xn} with allied possibilities, the average output of source evidence called entropy [33]. Entropy of an image can be calculated as:

$$ H=-\sum \limits_{n=0}^{2^N-1}p\left({x}_n\right){\log}_2p\left({x}_n\right), $$
(17)

where xi is the source image and 2N is the aggregate of data. For perfectly indiscrimination in digital contents, the ideal Shannon entropy is 8. The entropies of different standard plain images and their encrypted contents accounted in Table 8.

Table 8 Information entropies analyses for plain and encrypted images of size 512 × 512

The entropy esteems of encrypted images are very close to ideal Shannon esteem, which implies the leakage of data in proposed encryption algorithm is inappropriate and the mechanism is secure upon entropy attacks [34]. The information entropies of suggested scheme for encrypted images have superior results, when compared with existing approaches. Table 9 demonstrate the comparison of proposed technique with existing approaches for standard images.

Table 9 Comparison of information entropies of proposed scheme with modern approaches

4.7 Gray Level Co-Occurrence Matrix (GLCM) Analyses

The visual strength of anticipated scheme analyzed here by homogeneity, contrast and energy assessments [35]. The image assessed by homogeneity defined as:

$$ {H}_g=\sum \limits_{i,j}\frac{\rho\;\left(i,j\right)}{1+\mid i-j\mid }, $$
(18)

where i, j indicates the row and column position of image’s pixel. This analysis performs the closeness of distribution in GLCM to GLCM diagonally. Its range lies in between 0 and 1. The identification of an object in texture of image observed by contrast analysis and it is defined as:

$$ C=\sum \limits_{i,j}\;{\left|i-j\right|}^2\rho\;\left(i,j\right). $$
(19)

The contrast test range lies in between 0 and (size (image) − 1)2. Greater the contrast value illustrates the large number of variations in the pixels of an image while constant image has 0 contrast value. The energy analysis of an image returns the sum of squared elements in GLCM and defined as:

$$ E=\sum \limits_{i,j}\;\rho\;{\left(i,j\right)}^2. $$
(20)

The constant image has 1 energy, while range of energy lies in-between 0 and 1. GLCM analyses for plain and enciphered images for S (3/2) and S (5/2) demonstrated in Table 10.

Table 10 GLCM analyses among original and encrypted standard images and comparison with existing approach

4.8 Linear Attacks Analyses

To perform linear attacks, cryptanalyst has to identify the linear relation between some bits of plain image, cipher image and key. By considering this relation, cryptanalyst can easily understand the structure used in encryption and decryption [36]. The analyst decrypts each cipher using all possible keys to predict the sequence similarity in ciphers, but in our case, the analyst has no idea what spin system used for encryption. Either the message pass by one or multiple spin systems and each spin system has 24! states, and in each state there are infinite positions for encryption. All the spin matrices create confusion and also have infinite possibilities to create the keys. The analyst can focus on statistical analyses against multiple rounds of decryption but each time the results produced with proposed structure has no relation with any previous outcome.

4.9 Differential Attacks Analyses

To testify the robustness against differential attacks for anticipated scheme, an adjustment of one pixel in plain image modifies the encrypted image for comparing, with a probability of half pixel altering. For a change in ith chunk of permuted digital image affects the ith chunk of ciphered image directly. We certify that our structure has suitable affectability to plain images to affirm the impact of altering a single pixel in a plain image and the whole enciphered image. For a specific objective to measure the impact of minor alteration in plain image on its encrypted one, the number of pixels changing rate (NPCR) bound together to originate the unified average change intensity (UACI) [37, 38]. The NPCR and UACI can be assessed by utilizing the succeeding expressions for two encoded images C1(i, j) and C2(i, j), in which one have source image just varied by one pixel. The expression for NPCR and UACI are given below:

$$ \mathrm{NPCR}={\sum}_{i,j}\frac{D\left(i,j\right)}{W\times H}\times 100\%, $$
(21)

where

$$ {\displaystyle \begin{array}{c}D\left(i,j\right)=\Big\{{}_{1,\kern0.36em {C}_1\left(i,j\right)\ne {C}_2\left(i,j\right)}^{0,\kern0.36em {C}_1\left(i,j\right)={C}_2\left(i,j\right)}\kern0.24em \\ {} UACI=\sum \limits_{i=0}^{M-1}\sum \limits_{j=0}^{N-1}\frac{\mid \raisebox{1ex}{${C}_1\left(i,j\right)-{C}_2\left(i,j\right)$}\!\left/ \!\raisebox{-1ex}{$255$}\right.\mid }{W\times H}\times 100\%\end{array}}. $$
(22)

To evaluate the sensitivity of plain image, encrypt the plain image and randomly choose and altered one pixel in plain image. Tables 11, 12 and 13 provides the experimental outcomes for encrypted results of NPCR and UACI and their comparison with existing latest approaches.

Table 11 NPCR analyses between original and encrypted images and comparison with existing approach
Table 12 UACI analyses between original and encrypted images and comparison with existing approach
Table 13 Pixels difference analyses by introducing noise between plain and enciphered standard images

Table 11 validates the NPCR esteems are correspondent to the perfect estimation of 1, while Table 12 correspond the UACI esteems which have better results than existing approaches. These outcomes show that projected technique has great degree sensitive to minor change in plane image, irrespective of whether the two ciphered images have one-bit alteration [30]. The anticipated structure has superior ability to hostile the differential assaults in investigation with alternative approaches.

4.10 Noise Attacks Analyses

It is possible that encrypted data affected by noises during transmission. The robustness of the proposed structure against Gaussian noise considered here. The normalized intensities of noise are set as 0.000001, 0.000003, 0.000005 and 0.000007 respectively.

As the intensity of noise change from 0.000001 to 0.000007, the PSNR value has very minute change or we can say its approximately same to the original, which depicts the proposed design has good robustness against noise attacks.

5 Conclusion

The proposed scheme is appropriate for real time applications due to small processing time and superior capacity to hostile the attacks and appropriate performance than other encryption systems. The Kramer’s spin system not only valid for RGB contents but it can be applied at variety of digital contents like audio, video, medical images and satellite images. In future, we would like to use quantum iterative maps instead of Redheffer and orthogonal codes to enhance security level.