“…= eye(2);%defined the related unitary transform = sym([1/2^(1/2),1/2^(1/2);1/2^(1/2),-1/2^(1/2)]); = sym([0,1;1,0]);Z = sym([1,0;0,-1]);S = sym([1,0;0,1i]); 4 S_adjoint = transpose(conj(S)); 5 CNOT = sym([1,0,0,0;0,1,0,0;0,0,0,1;0,0,1,0;]);6 %CNOT with 3 qubits involved,the 3rd qubit act as target,the 1st qubit act as control 7 CNOT_13 = sym(blkdiag(eye(4),X,X)); ,j -4) = sym(1); 17 end 18 %the 4th qubit act as control,the 1st qubit act as target 19 CNOT_41 = sym(zeros(16,16)); 20 for j = 1 : 2 : 15 21 CNOT_41(j,j) = sym(1); ([1/2;1/2;1/2;1/2]);%set the input state 30 oracleQubit = sym([1/sqrt(2);-1/sqrt(2)]); 31 plainState = kron(dataQubits,oracleQubit); 32 %randomly generate a 4-bit encryption key, the 1st row is x0,the 2nd is z0 33 encKeyBits_forDataQubits = randi([0,1],[2,2]); 34 %the encrytion key for oracle qubit is 0,0 or unencrypted 35 encKeyBits = [encKeyBits_forDataQubits,[0;0]]; 36 disp('the random encryption key:');disp(encKeyBits); 37…”