Skip to main content
Scientific Reports logoLink to Scientific Reports
. 2023 Apr 11;13:5887. doi: 10.1038/s41598-023-33119-w

Quantum hash function based on controlled alternate lively quantum walks

Penglin Hou 1, Tao Shang 1,, Yuanjing Zhang 1, Yao Tang 1, Jianwei Liu 1
PMCID: PMC10090072  PMID: 37041296

Abstract

Quantum hash function is an important area of interest in the field of quantum cryptography. Quantum hash function based on controlled alternate quantum walk is a mainstream branch of quantum hash functions by virtue of high efficiency and flexibility. In recent development of this kind of schemes, evolution operators determined by an input message depend on not only coin operators, but also direction-determine transforms, which usually are hard to extend. Moreover, the existing works ignore the fact that improper choice of initial parameters may cause some periodic quantum walks, and further collisions. In this paper, we propose a new quantum hash function scheme based on controlled alternate lively quantum walks with variable hash size and provide the selection criteria for coin operators. Specifically, each bit of an input message determines the magnitude of an additional long-range hop for the lively quantum walks. Statistical analysis results show excellent performance in the aspect of collision resistance, message sensitivity, diffusion and confusion property, and uniform distribution property. Our study demonstrates that a fixed coin operator, along with different shift operators, can effectively work on the design of a quantum hash function based on controlled alternate quantum walks, and shed new light on this field of quantum cryptography.

Subject terms: Computer science, Quantum information

Introduction

Hash function plays an important role in modern cryptography, which is considered a key component of almost all encryption schemes and many security applications, such as message authentication code, data integrity, data storage, and random number generation. In the classical context, hash function can map a message of arbitrary length to a fixed-size output. Generally, there are two types of hash functions in terms of security attributes. One is the collision-resistant hash function that has provable security reductions and the other is based on an iterated construction of compression functions. The former satisfies computational security but is too inefficient to be used in practice. Some provably secure examples can reduce to hard problems, such as the integer factorizationproblem1, the very smoothnumber nontrivialmodular squareroot problem (VSSR)2, and the Knapsack problem3. The latter is easily designed and more efficient because the design of hash functions can be transformed into that of compression functions4. Meanwhile, cryptanalysis attacks also have gradually emerged in recent years, which poses a huge challenge to the security of such hash functions5.

With the development of quantum computing, more and more researchers have shown increasing interests in using quantum mechanisms to develop cryptographic algorithms with high security, especially the quantum hash function, which is one of the most important in cryptographic discussions623. There are two approaches of research on quantum hash functions. One is based on quantum one-way functions (QOWF)611, while the other one is based on quantum simulation, including discrete-time quantum walk (DQW)1321,23, continuous-time quantum walk (CQW)22 and grouped coarse-grained boson sampling (GCGBS)12. The former has attempted to formally define the one-way and collision resistance property of quantum hash functions, which have been conclusively proved with a rigorous mathematical form. The latter constructs quantum hash functions by virtue of quantum mechanics, specifically, the chaotic characteristic of quantum walk or the irreversibility of GCGBS without formal security proof. Alternatively, one can evaluate such types of schemes through statistical analysis which can provide quantitative evidence. Moreover, QOWF-based quantum hash functions map a classical bit string to a quantum state whose lengths are positively related to the length of an input message. By contrast, DQW-based, CQW-based and GCGBS-based quantum hash functions generate a fixed-length classical hash value from a classical bit input. Of particular concern is QOWF-based schemes are only guaranteed to correctly distinguish the quantum hash states of two different input messages with a high probability by means of SWAP test, which means such schemes are non-deterministic with a one-side error. In addition, GCGBS-based quantum hash function could only be efficiently calculated through a linear optical network, but is awkward to perform on a classical computer due to high time complexity. In accordance with the above, the practical value of DQW-based and CQW-based quantum hash functions are higher compared to those based on QOWF and GCGBS, because the former has deterministic outputs for fixed inputs and can be simulated classically before the advent of commercial quantum computers.

As we know, the construction of quantum walks based quantum hash function relies on different quantum walks procedures with various unitary evolution operators which can be generally decomposed into coin and shift operators. Such schemes begin with an initial quantum state, then the evolution of the system proceeds by repeatedly using different unitary operators controlled by the input bit string, it will then obtain a classical hash value by post-processing algorithm, i.e., modular and truncation arithmetic. Li et al.23 explored, for the first time, a brand-new perspective on the design of a dedicated hash function based on quantum walks. They presented a quantum hash function whose underlying model is one-dimensional two-particle controlled interacting quantum walks (CIQW), and discussed the security and feasibility of the scheme. Over the past decade, more information has become available on the quantum hash functions based on quantum walks, particularly for the quantum hash functions based on controlled alternate quantum walks (CAQW)13,1517,19, which are the improvement and extension of CIQW-based quantum hash functions21,23. Until now, almost all such schemes control the evolution of quantum walks by alternate coin operators, little attention has been paid to the role of shift or other operators besides coin operator. Recently, an extra operator called the direction-determine transform has been introduced in the work of Zhou et al.15, which can also be considered for a CAQW-based quantum hash function. In order to explore whether more operators are valid for designing a CAQW-based quantum hash function, we introduce lively quantum walks with variable liveliness parameters to construct a new CAQW-based quantum hash function.

The main contributions of this paper are described as follows:

  1. Construction of a novel quantum hash function with variable hash size based on controlled alternate lively quantum walks with variable liveliness parameters, named QHFL. Also, the conditions for a periodic quantum walk are discussed, and used to design a secure CAQW-based quantum hash function.

  2. Verification for feasibility and security of the proposed quantum hash function in both quantum and classical environments. Through theoretical analysis and statistical experiments, the results demonstrate the proposed scheme has an excellent performance and its scalability is better than that of an existing state-of-the-art CAQW-based quantum hash function15. Moreover, an efficient quantum circuit is given for implementation.

The rest of this paper has been organized in the following way: The “Preliminaries” introduces necessary preliminaries about the notion of hash function and quantum walk. The “Methods” is concerned with the scheme named QHFL. In the “Security analysis” and the “Statistical performance analysis”, the security analysis and statistical performance of QHFL are discussed, respectively. In the “Computing complexity”, both classical and quantum computing Complexity is offered. In the “Advantage”, the advantages of QHFL is are briefly discussed. Finally, the “Discussion” gives a summary of this work and provides directions for further research.

Preliminaries

Cryptographic hash function

A cryptographic hash function must satisfy three criteria: preimage resistance, second-preimage resistance and collision resistance.

  • Preimage resistance

    A hash function is a one-way function. For any valid output, it is computationally infeasible to find the corresponding input. In particular, a function mapping f:0,10,1 is a strong one-way function if it satisfies all of the following conditions:

    Easy to calculate: f can be computed in polynomial time.

    Hard to invert: A polynomial p(·) exists such that for any polynomial time adversary’s algorithm A, in the case of sufficiently large number nN, has
    Prob[A(fx,1n)f-1(fx)]<1p(n). 1
    Given a message digest y, it is difficult to find its preimage x such that Hx=y, instead, its inverse process is computable.
  • Second-preimage resistance

    Finding any two inputs that have the same output is computationally infeasible, i.e., given an input x, find its second preimage x such that H(x)=H(x).

  • Collision resistance

    Finding two different inputs x and x such that their hash values are the same is computationally infeasible, i.e., H(x)=H(x). In fact, collision resistance implies second-preimage resistance but does not guarantee preimage resistance.

Lively quantum walk on an N-length cycle

Standard discrete-time quantum walk (DQW) is a quantum analogue of classical random walk, taking place in the product space HpHc in which a particle (walker) is placed at a vertex in a cycle and allowed to jump along the edges to adjacent vertexes. Here a particle starts from its initial state xc, where the spatial degree of freedom {x,xZN} spans the position space Hp, and the two-dimensional coin state c,c0,1 spans the coin space Hc.In DQW on an N-length cycle, each evolution of a system proceeds by a unitary operator, which is defined as U=SINC, where S is the shift operator updating the position chirality states of the particle, C is the coin operator on the coin space Hc determining the direction at each walking step, and IN is the N order identity matrix of Hp space.The shift operator is defined as follows:

S=xZNx+1(modN)x|00|+x-1(modN)x|11|, 2

then the evolution process of quantum walk can be defined in the situation by shift operator

Sx0=x+1(modN)0,Sx1=x-1(modN)0. 3

Such operator implies that the particle moves from one vertex to the left or right corresponding to the coin quantum state 0 or 1, respectively.

One-dimensional three-state quantum walks(or lazy quantum walks), the generalized Hadamard walks(DQW) with three inner coin states, were first proposed by Konno et al.24. In recent years, Sadows et al.25 introduced a new family of quantum walks on cycles parametrized by their liveliness (named lively quantum walks). The introduced family contains lazy quantum walks, which can be considered as lively quantum walks with liveliness equal to zero.

Consistent with DQW, the process of a lively quantum walk on an N-length cycle occurs in Hilbert space HpHc, where Hp represents the position space, whose orthogonal basis is given by the label of each vertex on the N-length cycle, and defined as Hp=Spanx, xZN. Hc represents the three-dimensional coin space, which is defined as Hc=Spanc,c{0,1,2}. Then, a formulation for the lively quantum walk can be defined.

The shift operator S of the lively quantum walk acting on each vertex x is given by

S=xzNx+1(modN)x|00|+x-1(modN)x|11|+x+τ(modN)x|22|, 4

with a liveliness parameter τN2(· represents a ceiling function), which controls the particle to make an additional choice of hop. Thus, the entire evolution of the quantum system at each time step can be described by U=SINCHpHc, with a usually used coin operator called Grover operator G. G=2svsv|-I, where sv=13(0+1+2), and we can obtain G=-13232323-13232323-13.

Periodic quantum walk on a cycle

Under certain conditions, some coin operators may give rise to periodic quantum walks. Here, some necessary conditions for specific quantum walks with periodicity2630 have been discussed. In particular, for the lazy quantum walk, Konno and Kajiwara29 studied the necessary condition that the coin operator to have a finite period. For a more general case, the periodicity phenomenon for lively quantum walks on cycles, generated by the combination of variable parameters of liveliness and generalized Grover coins, have been thoroughly studied. Sarkar and Mandal30 regarded the coin operator as a linear combination of orthogonal permutation matrices, extending the study of periodic lively quantum walk. Permutation matrices of this type are called Grover-type matrices, see A for details. According to Ref.27, the periodic quantum walk on a cycle can be defined as follows:

Periodic quantum walk on a cycle

Define a set as N={n1N:Un=I}, where N is the set of nature numbers, U is the evolution operator corresponding to the quantum walk on a cycle, and I is an identity matrix. If N, the period T of the quantum walk on a cycle is written as minN. Otherwise, for the case of N=, the quantum walk on a cycle has a period defined as and is called an aperiodic quantum walk. In particular, the periodicity for quantum walk on a cycle means that the particle returns precisely to its quantum initial state after a finite number of steps.

Methods

In this section, we introduce the controlled alternate lively quantum walk with variable liveliness on a cycle, then give the specific scheme for the quantum hash function based on it, named QHFL.

Controlled alternate lively quantum walk on an N-length cycle

The controlled alternate lively quantum walk can be constructed by cleverly modifying lively quantum walk on an N-length cycle. Assume that the particle performs the lively quantum walk on an N-length cycle with liveliness parameter τ. At the t-th time step, the quantum state amplitude of a particle at the position x is given by ψx,t=ax,t1ax,t2ax,t3=cax,tccHc, where ax,tc represents the quantum state amplitude of the particle in the coin register, so the state of the whole system can be defined as

Ψt=xzNxψx,t. 5

For the initial state Ψt=0 with a unitary operator U to update the quantum state at each step, the time evolution of the quantum state is defined as Ψt=UtΨt=0. Thus, the transformation of amplitude for the particle at the position x can be obtained as follows

ψx,t+1=C1ψx+1,t+C2ψx-1,t+C3ψx+τ,t, 6

where Ci=k=13C~i,kik,i{1,2,3},C~i,k is the element in the i-th row and k-th column of matrix C. Now we can introduce the controlled alternate lively quantum walk with liveliness on a cycle.

Specifically, given an input message msg, each bit {m1,m2,mt}{0,1}t of the message is a string of binary numbers, so the quantum walk evolution operator controlled by t bits message is Umsg=Um1Um2Um3Umt, where Umj(1jt) denotes the evolution operator of j-th step which can be designed with variable liveliness parameters given by Eq. (4). Accordingly, the final quantum state can be expressed as Ψfinal=UmsgΨt=0. Then, after t steps, the probability of finding the particle being in the position x is given by

px=ψx,t|ψx,t=c=13ax,tc2, 7

satisfying the condition c=13xzNax,tc2=1, where ax,tc can be obtained by means of measuring the basis state x,c,

x,cUtΨt=02. 8

Quantum hash function based on controlled alternate lively quantum walks

For an initial state Ψt=0=xc, where c=a10+a21+a32, taking message msg as an input, the specific steps of QHFL can be described as follows:

  1. Select a set of initial parameters N,l,s,C,a1,a2,a3, where N is an integer, representing the number of vertexes in a cycle, l represents the amplification factor of the probability with the constraint 10l2s, C is a coin operator selected from a set that meets the security requirement, a1,a2,a3 are the amplitudes of the three-state coin registers in the initial state, which satisfy a12+a22+a32=1.

  2. Apply Umsg to the initial state Ψt=0 and generate the final probability distribution for each position, denoted by P=p0,p1,p2,pN-1, wherepxxzN is the probability of the particle in its final state finding at each vertex of the cycle given by Eqs. (7) and  (8).

  3. Perform the post-processing algorithm on the obtained probability distribution to generate N×s hash values. In particular, perform px·10lmod2s on px. Then concatenate these s-bits hx(xzN) together to form the final hash valueh=h0h1h2hN-1 .

Security analysis

In this section, we will discuss the security of the proposed scheme against the preimage attack, the force search attack and the force search attack.

Preimage resistance

Hash functions should have one-wayness, which guarantees the security of plaintext information from malicious adversaries, i.e., the adversary cannot guess the original message through the hash value with a non-negligible probability. We define a message space M, quantum state space Q and hash space H. Function mapping f:MQH firstly maps the message msg{0,1}L to the quantum state of a quantum system, denoted by Ψfinal, then to the hash space h{0,1}m,m<L, which is a classical-classical mapping. Moreover, the inversion of this mapping is tough to accomplish with two shields. The first shield is using the post-processing algorithms to obtain the hash value by truncation arithmetic and modular arithmetic on the probability of vertexes, which obviously is a many-to-one mapping. The second shield is based on the irreversibility of quantum measurement on the final state, which breaks the linear relationship between the final state and the initial state, even if the adversary takes the hash value in hand and has a priori knowledge of initial state. For example, assume that the message length L is disclosed to the adversary, there is no efficient polynomial time algorithm A(f(x)) to try all of 2L guesses, which satisfies Eq. (1). Therefore, when the message space is sufficiently large, the adversary cannot backtrack the original message by hash value with a non-ignorable probability.

Force search attack resistance

Cryptographic hash functions are designed to keep their output as short as possible, but it is still be difficult to find collisions. There is a powerful attack for hash functions acting on hash value, birthdayattack31. The birthday attack can find the collision of the target hash h with a 50% probability of only having O(sN) expected times. For classical computers, the general hash length of sN2128 can satisfy the condition of cryptographic security. Because of the extensibility of the hash length in our proposed scheme, we can easily construct hash functions that satisfy the security conditions.

Forgery attack resistance

Here forgery attack means that a valid message-hash pair can be obtained from other message-hash pairs that are of equal or variant lengths. The forgery attack is closely related to the second-preimage resistance of the hash function. To demonstrate such attack on the original scheme, following procedure is introduced.

Periodic quantum walk on a cycle is defined above in definition Periodic  quantum   walk  on   a   cycle. If there is more than one quantum walk with a finite period, it will be easy to generate collisions in all DQW-based hash functions. Specifically, assume a quantum walk algorithm with a chosen evolution operator U1 (executed when the message bit is 1) has a finite period T. In that case, U1TΨt=0=IΨt=0=Ψt=0, so for a message msg=1010, any nT,n{1,2,3} message bits can be inserted into the message string, then a collision can be formed as

Umsg=U1U0U1U0=U1U0U1U1IU1U0. 9

Anyone can easily construct a collision at this point, making such algorithms no longer satisfy the collision resistance property. Therefore, when designing a hash function based on quantum walks, proper parameters should be selected to avoid this situation. The coin operator of controlled alternate lively quantum walk on a cycle is selected from Grover type of matrix set in A, which will provide strict security and collision resistance. Consequently, collisions may only be affected by computational precision or by truncation and modular operations.

Statistical performance analysis

It is difficult to evaluate the security of the proposed scheme by rigorous mathematical proof. So widely accepted statistical tests can be used to evaluate the performance and feasibility of the scheme. We take the same public arxiv Dataset as Ref.15 used and randomly select from about 2 million records as the input string. Note that since DQW-based hash functions are classical input and classical output, the hash value of a message in classical computation is usually generated and stored in ASCII format.

In “Force search attack resistance”, the security lower bound for the birthday attack of the hash function is given. To ensure the security of the scheme, we generate Len=sN>256-bit hash values, i.e., Len{296,264}. As with other existing DQW-based hash functions, two instances of QHFL share the same l value, and the remaining parameters are C=Grov, α1=α2=α3=13. The statistical performance analyses include: Collision resistance, sensitivity, diffusion and confusion propertiy, uniform distribution. The test results will be compared mainly with the typical scheme QHFM15.

Collision resistance

Collision resistance is an important property of cryptographic hash functions. Such property of hash functions can be quantified by collision test. In general, collision resistance is assessed by two types of tests, T1 and T2. In the test T1, a random input message is selected and computed to obtain an ASCII hash value h1. In the test T2, a random bit reversal is performed on the message in the test T1, and the corresponding hash value h2 is also generated and stored in ASCII format by h1={b1,b1,bs} and h2={b1,b1,bs}, respectively, where bi and bi are the ith ASCII characters, and s=Len8 represents the size of the hash value in ASCII format.

Moreover, we compare the number of characters of h1 and h2 with the same value at the same location, i.e., the number of hits, and calculate as follows:

ω=iNδ(T(bi),T(bi)), 10

where δ(x,y)=1,x=y0,xy indicates that bi and bi are converted to the corresponding decimal values with T(bi), T(bi){0,1,2,,255}.

Through J=10000 times independent experiment of drawing records from the arxiv dataset and assuming that the hash value distribution is uniform and random, the theoretical number of tests can be given by the binomial distribution formula:

Wtω=J×Probt{ω}=Js!ω!s-ω!128ω(1-128)s-ω, 11

where ω=0,1,,s, Probt{ω} is the probability distribution of the theoretical number of hits (the probability distribution of the experimental number of hits is denoted by Probe{ω})), and the distance with the theoretical value can be measured by means of Kullback-Leibler relative entropy (KL divergence)32

D(Probt{ω}Probe{ω})=ω=0sWtωJlog2WeωJ×Probt{ω}. 12

The smaller D(Probt{ω}Probe{ω}) is, the closer Wtω and Weω are, which means that the hash function has the exceptional collision resistance property.

The collision resistance property can also be quantified by the absolute difference between two hash values (i.e., the distance between two hash values):

d=is|T(bi)-T(bi)|. 13

The experimental mean difference per byte of two hash values can be calculated by d, then obtain the absolute difference between it and its theoretical value is denoted by d¯=|d¯t-d¯e|. Since the spatial distribution of ASCII characters is independent and uniform, and d¯t can be calculated by the following equation33:

d¯t=ETbi-Tbi=13×Lev85.3, 14

Lev=256 is the number of levels. As the number of experiments increases, d¯e will converge to d¯t, which means better property of collision resistance. As we can see from Table 1, two instances of our scheme have a smaller D(Probt{ω}||Probe{ω}) and Δd¯ compared with those in QHFM, which implies that our scheme has better performance in the collision test.

Table 1.

Collision resistance test results.

Instance Numbers of hits ω D(Probt{ω}Probe{ω}) d¯
0 1 2 3 4
QHFL-296 Weω 8637 1278 81 4 0 0.00009977 0.15
Wtω 8652 1255 89 4 0
QHFM-29615 Weω 8662 1250 85 2 1 0.00001848 0.13
Wtω 8652 1255 89 4 0
QHFL-264 Weω 8784 1133 82 1 0 0.00024273 0.02
Wtω 8788 1137 71 3 0
QHFM-26415 Weω 8853 1074 73 0 0 0.00072578 0.11
Wtω 8788 1137 71 3 0

So far this section has focused on collision test to assess the collision resistance. The main criterion for collision resistance of a hash function is that the hash value has less number of hits when a random bit reversal is performed on the input message. When the discrete-time quantum walks perform on an even-length cycle starting in the position 0 after odd steps, then the probability at the even vertexes is zero, while the odd vertex is not zero. This periodic behavior is similar on lively quantum walk with an odd lively parameter on an even-length cycle τ. The issue that emerges from these pattern is that the collision test can not pass. However, the lively quantum walks with even lively parameters τ do not show such periodic pattern for both even-length cycles and odd-length cycles. It can thus be suggested that the quantum hash function proposed in our paper can satisfy multi-level security, i.e., it can output variable-length hash values. By contrast, most quantum hash functions based on discrete-time quantum walks cannot satisfy this property, e.g., they cannot output a 256-bit hash value1420.

Sensitivity

An effective hash function needs to be extremely sensitive to the initial input, which means that any slight change in the input message will produce a hash value completely unrelated to the result of the original message. To verify the sensitivity of the proposed scheme, four experiments were designed and calculated with the following input information:

  • M1: Randomly draw a record from the dataset

  • M2: Randomly flip the bits of message M1 at a location

  • M3: Randomly insert a random bit at a location in message M1

  • M4: Delete a bit at a random location in message M1

The hash values corresponding to the above four input messages are HMj,j=1,2,3,4. Taking the instance that the output hash value length is L=296-bit, the hexadecimal format of the four hash values is described as follows:

HM1:D8CCADC2F92994BCBA291E6E790B848ED2ECF9A4D406D00DB40

084B7129C9CADB8BE6A504D

HM2:AD8E79F3A902AC2AA9C16FD35389ECA58C5ACAE9243EC67CB5F

1FF68576C5C2A5252F54B47

HM3:712DBD57C4300F84478C36FF9FAC6CF46DC2463EEA006FEA237

F1679FC93E019AA42FC017D

HM4:C8555E380EA9854F3F913CA2D30F86F1AA386748E0345E6F223

9FC84D1C986511F00F23AB0

The binary format of the hash values corresponding to the input messages M1–M4 is shown in Fig. 1, which demonstrates that even a slight change of the input message can also cause the new hash value to have a large deviation from the original hash value. This result further demonstrates that QHFL can satisfy the one-wayness well.

Figure 1.

Figure 1

Hash values in the binary format generated by QHFL-296. The symbol * represents a different bit between HM2 and HM2-HM4.

Since the hash value of the proposed scheme is calculated by the probability distribution of each vertex in the final state on the cycle, the distance between the discrete probability distribution corresponding to the modified message and the original message, respectively, can also be used as an indicator to measure the sensitivity of DQW-based hash functions.

For two discrete probability distributions P=(p1,p2,pN) and Q=(q1,q2,qN) on a finite alphabet of size N, the distance between them can be measured by Jensen-Shannondivergence (JSD)34, which is denoted by JSD in the sensitivity test. Different from KL divergence, it is a symmetric function, defined everywhere, with values between 0 and 1. The larger JSD value indicates the farther distance between the two probability distributions. KL divergence can be modified slightly to obtain the JSD formula

JSD(ProbM1ProbMk)=12D(ProbM1ProbMk)+12D(ProbMkProbM1), 15

where Mk denotes a modified message with a range of k{2,3,4}, and D(··) denotes the KL divergence in Equation 12. After repeating 2048 independent sensitivity test experiments, as listed in Table 2, the QHFL scheme is more sensitive to messages in comparison with the QHFM scheme.

Table 2.

JSD-sensitivity test results.

Instance M2 M3 M4
QHFL-296 0.0810050584976550 0.136948519786094 0.137304527477550
QHFM-296 0.0433801323884277 0.0578510007648174 0.0574491187555278

Diffusion and confusion property

Diffusion and confusion methods, first introduced by Shannon35, can effectively impede the statistical analysis of encryption algorithms. In the context of a hash function, diffusion (often referred to as the avalanche effect) allows any slight impact on the original message and is propagated throughout the whole output, which means that the output hash is highly correlated with the input text. For the binary format of the input and output hash values, any change in the original message bit leads to a change in each bit of the hash value with a 50% probability. Confusion attempts to hide the input message and the relation between the key and the output hash value, which means that it is difficult for an adversary to break the security of the hash function by means of statistical analysis.

To evaluate the diffusion and confusion performance of QHFL, we independently repeat the following experiments J=10,000 times. In the ith experiment, the original message M1 generates its corresponding hash value h, and then randomly selects and flips a bit in M1 to obtain a new hash value h. The new L-bit hash value is then compared with the original message, and followed by calculating their Hamming distance Bi=k=1|h|h(k)h(k) between the two hash values per experiment. Four statistical indicators can be further calculated to evaluate the diffusion and confusion property of the proposed hash function:

  • Mean number of bits changed B¯=i=1JBiJ bit

  • Mean probability of change per bit P=B¯|h|×100%

  • Standard deviation of the changed bit number ΔB=1J-1i=1J(Bi-B)2 bit

  • Standard deviation of the mean change per bit probability ΔP=1J-1i=1J(Pi-P)2×100%

The ideal values of B¯ and P(%) are L2 and 50%, respectively. Meanwhile, a smaller standard deviation of ΔB and ΔP(%) can also explain the stability of the diffusion and confusion effects. Comparison between QHFL and QHFM is listed in Table 3. It can be concluded from the results that the ΔB and ΔP(%) of QHFL are slightly less than or approximately equal to QHFM. In addition, it is obvious that B¯ and P(%) of QHFL are approximate to the ideal values, which are on the same level as QHFL.

Table 3.

Results of diffusion and confusion tests.

Instance B¯ P(%) ΔB ΔP(%)
QHFL-296 148.19 50.06 8.55 2.89
QHFM-296 147.91 49.97 8.81 2.98
QHFL-264 132.03 50.01 8.11 3.07
QHFM-264 131.96 49.98 8.16 3.09

Differential analysis exploits weaknesses in the diffusion and confusion property and is based on the analysis of the correlation between some input differences and the output differences. These differential attacks can pose a serious threat to the security of hash functions as well. If there is a strong correlation between different inputs and outputs, one can easily detect message collisions. Therefore, diffusion and confusion is a strong indicator for assessing the resistance of hash functions against the differential analysis attacks. Excellent diffusion and confusion property evaluated from tests indicate that the proposed scheme has robust resistance and reliability to differential analysis attack.

Uniform distribution

In general, the uniform distribution of output hash values over the compression range is one of the most critical security features. When the output space of a hash function is uniformly distributed, the input message will hide the statistics of the original message after diffusion and confusion. As shown in Fig. 2, we count the number of tests to flip a hash bit at each location ,and the result is visually described in the form of a histogram, which proves that the QHFL scheme is able to resist statistical analysis attacks.

Figure 2.

Figure 2

Histogram of the 296-bit hash space.

Computing complexity

For the case where QHFL with L bits input and O(N) bits output, it is easy to perform both in the quantum and classical computer, specifically, only up to O(LN) time complexity is required in the classical case, and at most, O(log2N)-sized elementary gates along with memory are necessary for the quantum case. In the classical context, it is trivial to obtain the time and space complexity of these schemes by analyzing the number of arithmetic operations performed during the entire hash process15. Such schemes can also be efficiently implemented under quantum computing models by performing controlled alternate lively quantum walks, such that we can give the design of quantum circuit for QHFL by some trivial alterations on the quantum circuit of DQW.

Classical time and space complexity

The quantum evolution at each step of controlled alternate lively quantum walk on an N-length cycle is simulated by matrix multiplication. The quantum state at the t-th step can be denoted by Ψ(t)=xzNax,tcx,c or in Eq. (5). Each step performs a quantum evolution via a unitary operator U1=S1INC or U0=S0INC controlled by message bits, where S1 and S0 represent the shift operators of different τ, C is the coin operator, denoted by C1C2C3. Where Ci=k=13Ci,kik,i{1,2,3}, Ci,k are the elements in the i th row and k th column of the matrix C. After combining Eqs. (5) and (6), the transformation of coin operator acting on ψx,t can be formulated as

Ψt+1=xzNC1ax+1,t1ax+1,t2ax+1,t3x+1,0+xzNC2ax-1,t1ax-1,t2ax-1,t3x-1,1+xzNC3ax+τ,t1ax+τ,t2ax+τ,t3x+τ,2, 16

where x+1, x-1, and x+τ are all calculated by modular arithmetic under modulus N. According to Eq. (16), the amplitude of the quantum state Ψt is given by

ax+1,t1ax+1,t2ax+1,t3=ax+1,t1ax+1,t2ax+1,t3+ax,t-11ax,t-12ax,t-13C1ax-1,t1ax-1,t2ax-1,t3=ax-1,t1ax-1,t2ax-1,t3+ax,t-11ax,t-12ax,t-13C2ax+τ,t1ax+τ,t2ax+τ,t3=ax+τ,t1ax+τ,t2ax+τ,t3+ax,t-11ax,t-12ax,t-13C2. 17

The calculation process of the QHFL scheme consists of two parts of arithmetic operations. The first part is to update the quantum state amplitudes, and the second is to use multiplication and modular arithmetic to obtain the final hash value. Since the liveliness parameter τ is controlled by each message bit, a QHFL with L steps has the same complexity as the controlled alternate lively quantum walk on an N-length cycle with message length L. Given the quantum state amplitude at the t-1th step and the position x, the new quantum state amplitude at the tth step can be updated by only 9 multiplications and 9 additions. For a cycle with N vertexes, each step will take O(N) basic arithmetic operations. Obviously, for an input message of L bits, the basic operations required for obtaining the value of amplitude only increase by O(LN). In addition, such computation needs 3N registers to store the amplitude values, so the space complexity is O(N). The time and space complexity of other existing schemes can be analyzed by using similar processes related to the length of the output hash value. As a result, QHFL has the same classical time and space complexity as its peers1319,21,23 except Cao-19520.

Quantum circuit and resource consumption

For the reason of exponential speedups, quantum implementations of the proposed scheme must scale logarithmically with graph scale on which it performs. As a structure with a high degree of symmetry, a small number of parameters can characterize the cycle36,37. QHFL, whose underlying model controlled alternate lively quantum walk on the N-length cycle can be regarded as the DQW proceeding around a slightly modified N-length cycle with additional connections for each transition, such that each vertex on the cycle has three adjacent edges. Then, we give an efficient quantum circuit to implement QHFL by referring to Ref.36.

There are three associated spaces: the vertex space, in which x lies, the coin space, in which c lies, the message space, in which msg lies. We firstly assign each vertex x a bit string in lexicographic order to encode the vertex space, then use log23 (rounded up to a nearest integer) additional qubits to encode the coin space, where the first three bit strings represent the three edges of each vertex. In the end, one qubit is required to encode the message space, with each computational basis 0 and 1 representing the input message bits 0 and 1, respectively. The shift operator can be implemented by a cyclic permutation gate, which increases or decreases a vertex bit string value into its adjacent vertexes in Fig. 3, and the coin operator is the Grover operator defined on log23 dimensions. Such quantum circuit is made up of generalized CNOT gates, which O(log2N) additional ancillary qubits and O(log2N) elementary gates are also required. An example of the quantum circuit for the implementation of QHFL at per step controlled by per message bit is shown in Figs. 4 and  5.

Figure 3.

Figure 3

Increment and Decrement gates on n qubits.

Figure 4.

Figure 4

Quantum circuit implementing QHFL with the liveliness parameter τ=2 alone a 37-length cycle controlled by message bit 1.

Figure 5.

Figure 5

Quantum circuit implementing QHFL with the liveliness parameter τ=0 alone a 37-length cycle controlled by message bit 0 per step.

Advantage

Through the above analysis, QHFL performs better in tests of statistical performance than other QW-based quantum hash functions. Furthermore, QHFL has some advantages than other CAQW-based quantum hash functions benefit from the structure of controlled alternate lively quantum walks on cycles.

Applying the controlled alternate lively quantum walk as an underlying algorithm for quantum hash functions presents several useful attributes. Firstly, simply changing the liveliness parameters, not just the coin operators of the controlled alternate lively quantum walk employed results in a totally different hash output. Without introducing an additional direction-determine operator as in QHFM, QHFL can implement different quantum hash functions for different purposes by setting unique liveliness parameters, for each purpose. Secondly, the structure of controlled alternate lively quantum walks can be modified, allowing for a longer hash output, simply by changing the cycles on which controlled alternate lively quantum walks perform. As described on the collision resist in previous section, QHFL performed on an even-sized cycle will not result in regular hash values. Consequently, differently from some CAQW-based quantum hash functions1420, it can generate hash values with arbitrary length under suitable conditions.

Discussion

In this paper, we addressed to designing a new quantum hash function QHFL with variable output length, which is based on the controlled alternate lively quantum walks with variable parameters of liveliness. Its performance and security property are evaluated and compared with the existed state-of-art scheme. The selection criteria of coin operators was also discussed to guarantee the security conditions of QHFL, mainly to avoid collisions. The nature of DQW-based quantum hash functions are that different input messages correspond to completely divergent probability distributions of final quantum state. Thus we adopted an additional indicator JSD to evaluate the sensitivity of the probability distribution to a message. The analyses show that QHFL is with the near-ideal properties of collision resistance, sensitivity, diffusion and confusion property, and hash value uniform distribution property. Moreover, the proposed QHFL is a compatible hash function that can perform efficiently on both a quantum and a classical computer. We also design an efficient quantum circuit implementation of QHFL, which only requires ancillary qubits and elementary quantum gates in logarithmic complexity scaling with cycle size. Remarkably, the proposed scheme has better flexibility than the scheme based on the controlled alternate quantum walks with memory, because it is easy to replace the underlying lively quantum walks by changing the liveliness parameters. Thus, such research can facilitate the construction of novel CAQW-base hash functions without restricting the use of controlled coins. Furthermore, QHFL is suited for various security levels required among different applications.

Research on QW-based quantum hash functions is still in progress. Despite some positive results in the design of quantum hash functions, questions remain. Firstly, all the processes on a classical computer of QHFL are realized by multiplication and addition/subtraction operations, there is abundant room for further progress in efficiency. Secondly, the collision resistance and differential analysis attack resistance of the proposed quantum hash function is analyzed only by some statistical tests. In future work, more efficient constructions of combining other different quantum walks and using a parallel realization are therefore required to explore. And to develop a full analysis of QW-based quantum hash function, additional studies will be needed to perform a rigorous mathematical proof for our scheme.

Acknowledgements

This project was supported by the National Natural Science Foundation of China (No. 61971021), the Key Research and Development Program of Hebei Province (No. 22340701D), and the Chinese Universities Industry-Education-Research Innovation Foundation of BII Education Grant Program (No. 2021BCA0200) for valuable helps. The authors declare no conflict of interest.

A Periodicity of lively quantum walks on cycles

The set of Grover-type matrices30 can be represented as MGrov={23J-P;PP} where J is a matrix whose elements are all one, P={P1=I,P2=123,P3=132,P4=23,P5=12,P6=13} is the symmetric group S3 corresponding permutation matrices. Therefore, all parametric orthogonal matrices can be regarded as linear combinations of permutation matrices. The single-parameter orthogonal matrix group is described as follows:

Xθ=2cosθ+13(1-cosθ)3+13sinθ(1-cosθ)3-13sinθ(1-cosθ)3-13sinθ2cosθ+13(1-cosθ)3+13sinθ(1-cosθ)3+13sinθ(1-cosθ)3-13sinθ2cosθ+130<θ<2π, 18

then we have

  1. XθYθ, where
    Yθ=2cosθ-13-(1+cosθ)3+13sinθ-(1+cosθ)3-13sinθ(1+cosθ)3-13sinθ2cosθ-13-(1+cosθ)3+13sinθ(1+cosθ)3+13sinθ-(1+cosθ)3-13sinθ2cosθ-130<θ<2π. 19
  2. XθZθ, where
    Zθ=2cosθ+13(1-cosθ)3+13sinθ(1-cosθ)3-13sinθ(1-cosθ)3+13sinθ(1-cosθ)3-13sinθ2cosθ+13(1-cosθ)3-13sinθ2cosθ+13(1-cosθ)3+13sinθ0<θ<2π. 20
  3. XθWθ,where
    Yθ=2cosθ-13-(1+cosθ)3+13sinθ-(1+cosθ)3-13sinθ(1+cosθ)3+13sinθ-(1+cosθ)3-13sinθ2cosθ-13(1+cosθ)3-13sinθ2cosθ-13-(1+cosθ)3+13sinθ0<θ<2π. 21
  4. POθ=XθYθZθWθ

Without loss of generality, the necessary condition for the coin operators that satisfy the periodic lively quantum walks when CXθ is given by

lcm{clpl:0<lN-1},2ln=mlpl,gcdml,pl=1,cl=1,ifmlisevenandcl=2,ifmlisodd,ifC=I3,ifC{P2,P3}lcm{3,q},ifN=3andθ=2mπq,mqQ,gcd2m,q=1,C{I,P2,P3}lcm{3,2q},ifN=3andθ=(2m+1)πq,(2m+1)qQ,gcd2m+1,q=1,C{I,P2,P3},otherwise 22

Where lcm{·,·} represents the least common multiple, and gcd·,· represents the greatest common divisor. For example, we can consider two special coin operators in Xθ with parameters θ=π2 and θ=3π2, whose corresponding coin operators are described as follows: 131+331-331-33131+331+331-3313, and 131-331+331+33131-331-331+3313. Their corresponding periods are given by 12,N=3,N3.

Author contributions

T.S. and P.H. proposed the idea and conducted the analyses. All authors contributed to the writing and revisions.

Data availability

The arXiv dataset analyzed in this paper is publicly available at https://www.kaggle.com/Cornell-University/arxiv. The preprocessed dataset and experimental results are available from the corresponding author on reasonable request.

Competing interests

The authors declare no competing interests.

Footnotes

Publisher's note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

References

  • 1.Pointcheval, D. The composite discrete logarithm and secure authentication. in International Workshop on Public Key Cryptography. 113–128. 10.1007/978-3-540-46588-1_9 (Springer, 2000).
  • 2.Contini, S., Lenstra, A.K. & Steinfeld, R. Vsh, an efficient and provable collision-resistant hash function. in Annual International Conference on the Theory and Applications of Cryptographic Techniques. 165–182. 10.1007/11761679_11 (Springer, 2006).
  • 3.Damgård, I.B. A design principle for hash functions. in Conference on the Theory and Application of Cryptology. 416–427. 10.1007/0-387-34805-0_39 (Springer, 1989).
  • 4.Sobti R, Geetha G. Cryptographic hash functions: A review. Int. J. Comput. Sci. Issues (IJCSI) 2012;9:461. [Google Scholar]
  • 5.Bao, Z., Wang, L., Guo, J. & Gu, D. Functional graph revisited: Updates on (second) preimage attacks on hash combiners. in Annual International Cryptology Conference. 404–427. 10.1007/978-3-319-63715-0_14 (Springer, 2017).
  • 6.Ablayev F, Ablayev M, Vasiliev A, Ziatdinov M. Quantum fingerprinting and quantum hashing. Computational and cryptographical aspects. Baltic J. Mod. Comput. 2016;4:860. doi: 10.22364/bjmc.2016.4.4.17. [DOI] [Google Scholar]
  • 7.Ablayev, F., Ablayev, M. & Vasiliev, A. On the balanced quantum hashing. J. Phys. Conf. Ser.681, 012019. 10.1088/1742-6596/681/1/012019(IOP Publishing, 2016).
  • 8.Vasiliev A. Quantum hashing for finite abelian groups. Lobachevskii J. Math. 2016;37:753–757. doi: 10.1134/S1995080216060184. [DOI] [Google Scholar]
  • 9.Ziatdinov M. From graphs to keyed quantum hash functions. Lobachevskii J. Math. 2016;37:705–712. doi: 10.1134/S1995080216060202. [DOI] [Google Scholar]
  • 10.Ablayev F, Vasiliev A. Cryptographic quantum hashing. Laser Phys. Lett. 2013;11:025202. doi: 10.1088/1612-2011/11/2/025202. [DOI] [Google Scholar]
  • 11.Ablayev, F.M. & Ziatdinov, M. Universal hash functions from quantum procedures. in Proceedings of Kazan University. Physics & Mathematics Series/Uchenye Zapiski Kazanskogo Universiteta. Seriya Fiziko-Matematicheskie Nauki. 10.26907/2541-7746.2020.3.259-268 (2020).
  • 12.Shi J, et al. A quantum hash function with grouped coarse-grained boson sampling. Quantum Inf. Process. 2022;21:1–17. doi: 10.1007/s11128-022-03416-w. [DOI] [Google Scholar]
  • 13.Li, D., Ding, P., Zhou, Y. & Yang, Y. Controlled alternate quantum walk based block hash function. 10.48550/arXiv.2205.05983. arXiv preprintarXiv:2205.05983 (2022).
  • 14.Yang Y-G, Dong J-R, Yang Y-L, Zhou Y-H, Shi W-M. Usefulness of decoherence in quantum-walk-based hash function. Int. J. Theor. Phys. 2021;60:1025–1037. doi: 10.1007/s10773-021-04724-0. [DOI] [Google Scholar]
  • 15.Zhou Q, Lu S. Hash function based on controlled alternate quantum walks with memory (September 2021) IEEE Trans. Quantum Eng. 2022;3:1–10. doi: 10.1109/TQE.2021.3130256. [DOI] [Google Scholar]
  • 16.Yang Y-G, Bi J-L, Li D, Zhou Y-H, Shi W-M. Hash function based on quantum walks. Int. J. Theor. Phys. 2019;58:1861–1873. doi: 10.1007/s10773-019-04081-z. [DOI] [Google Scholar]
  • 17.Yang Y-G, et al. Simple hash function using discrete-time quantum walks. Quantum Inf. Process. 2018;17:1–19. doi: 10.1007/s10773-019-04081-z. [DOI] [Google Scholar]
  • 18.Yang Y, et al. Improving the efficiency of quantum hash function by dense coding of coin operators in discrete-time quantum walk. Sci. China Phys. Mech. Astron. 2018;61:1–8. doi: 10.1007/s11433-017-9132-y. [DOI] [Google Scholar]
  • 19.Li D, Yang Y-G, Bi J-L, Yuan J-B, Xu J. Controlled alternate quantum walks based quantum hash function. Sci. Rep. 2018;8:1–7. doi: 10.1038/s41598-017-18566-6. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 20.Cao W-F, et al. Constructing quantum hash functions based on quantum walks on Johnson graphs. Quantum Inf. Process. 2018;17:1–11. doi: 10.1007/s11128-018-1923-9. [DOI] [Google Scholar]
  • 21.Yang Y-G, Xu P, Yang R, Zhou Y-H, Shi W-M. Quantum hash function and its application to privacy amplification in quantum key distribution, pseudo-random number generation and image encryption. Sci. Rep. 2016;6:1–14. doi: 10.1038/srep19788. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 22.Shi W-M, Wang S, Pan T, Yang Y-G, Zhou Y-H. Continuous-time quantum hash function based on one-dimensional cycle lattice. Mod. Phys. Lett. B. 2022;36:2150241. doi: 10.1142/S0217984921502419. [DOI] [Google Scholar]
  • 23.Li D, et al. Discrete-time interacting quantum walks and quantum hash schemes. Quantum Inf. Process. 2013;12:1501–1513. doi: 10.1007/s11128-012-0421-8. [DOI] [Google Scholar]
  • 24.Inui N, Konno N, Segawa E. One-dimensional three-state quantum walk. Phys. Rev. E. 2005;72:056112. doi: 10.1103/PhysRevE.72.056112. [DOI] [PubMed] [Google Scholar]
  • 25.Sadowski P, Miszczak JA, Ostaszewski M. Lively quantum walks on cycles. J. Phys. A Math. Theor. 2016;49:375302. doi: 10.1088/1751-8113/49/37/375302. [DOI] [Google Scholar]
  • 26.Tregenna B, Flanagan W, Maile R, Kendon V. Controlling discrete quantum walks: Coins and initial states. N. J. Phys. 2003;5:83. doi: 10.1166/jctn.2013.3095. [DOI] [Google Scholar]
  • 27.Konno N, Shimizu Y, Takei M. Periodicity for the Hadamard walk on cycles. Interdiscipl. Inf. Sci. 2017;23:1–8. doi: 10.4036/iis.2017.A.01. [DOI] [Google Scholar]
  • 28.Dukes PR. Quantum state revivals in quantum walks on cycles. Results Phys. 2014;4:189–197. doi: 10.1016/j.rinp.2014.10.001. [DOI] [Google Scholar]
  • 29.Kajiwara, T., Konno, N., Koyama, S. & Saito, K. Periodicity for the 3-state quantum walk on cycles. 10.48550/arXiv.1907.01725arXiv preprintarXiv:1907.01725 (2019).
  • 30.Sarkar RS, Mandal A, Adhikari B. Periodicity of lively quantum walks on cycles with generalized Grover coin. Linear Algebra Appl. 2020;604:399–424. doi: 10.1016/j.laa.2020.07.006. [DOI] [Google Scholar]
  • 31.Girault, M., Cohen, R. et al. A generalized birthday attack. in Workshop on the Theory and Application of of Cryptographic Techniques. 129–156. 10.1007/3-540-45961-8_12 (Springer, 1988).
  • 32.Van Erven T, Harremos P. Rényi divergence and Kullback-Leibler divergence. IEEE Trans. Inf. Theory. 2014;60:3797–3820. doi: 10.1109/TIT.2014.2320500. [DOI] [Google Scholar]
  • 33.Preneel, B. Analysis and design of cryptographic hash functions. Ph.D. Thesis (Katholieke Universiteit te Leuven, 1993).
  • 34.Fuglede, B. & Topsoe, F. Jensen–Shannon divergence and Hilbert space embedding. in International Symposium on Information Theory. ISIT 2004. Proceedings. Vol. 31. 10.1109/ISIT.2004.1365067 (IEEE, 2004).
  • 35.Shannon CE. Communication theory of secrecy systems. Bell Syst. Tech. J. 1949;28:656–715. doi: 10.1002/j.1538-7305.1949.tb00928.x. [DOI] [PubMed] [Google Scholar]
  • 36.Douglas B, Wang J. Efficient quantum circuit implementation of quantum walks. Phys. Rev. A. 2009;79:052335. doi: 10.1103/PhysRevA.79.052335. [DOI] [Google Scholar]
  • 37.Douglas B, Wang J. Complexity analysis of quantum walk based search algorithms. J. Comput. Theor. Nanosci. 2013;10:1601–1605. doi: 10.1166/jctn.2013.3095. [DOI] [Google Scholar]

Associated Data

This section collects any data citations, data availability statements, or supplementary materials included in this article.

Data Availability Statement

The arXiv dataset analyzed in this paper is publicly available at https://www.kaggle.com/Cornell-University/arxiv. The preprocessed dataset and experimental results are available from the corresponding author on reasonable request.


Articles from Scientific Reports are provided here courtesy of Nature Publishing Group

RESOURCES