{VERSION 5 0 "IBM INTEL NT" "5.0" } {USTYLETAB {CSTYLE "Maple Input" -1 0 "Courier" 0 1 255 0 0 1 0 1 0 0 1 0 0 0 0 1 }{CSTYLE "2D Math" -1 2 "Times" 0 1 0 0 0 0 0 0 2 0 0 0 0 0 0 1 }{CSTYLE "2D Output" 2 20 "" 0 1 0 0 255 1 0 0 0 0 0 0 0 0 0 1 } {PSTYLE "Normal" -1 0 1 {CSTYLE "" -1 -1 "Times" 1 12 0 0 0 1 2 2 2 2 2 2 1 1 1 1 }1 1 0 0 0 0 1 0 1 0 2 2 0 1 }{PSTYLE "Text Output" -1 6 1 {CSTYLE "" -1 -1 "Courier" 1 10 0 0 255 1 2 2 2 2 2 1 2 1 3 1 }1 1 0 0 0 0 1 0 1 0 2 2 0 1 }{PSTYLE "Warning" -1 7 1 {CSTYLE "" -1 -1 "Co urier" 1 10 0 0 255 1 2 2 2 2 2 1 1 1 3 1 }1 1 0 0 0 0 1 0 1 0 2 2 0 1 }{PSTYLE "Maple Output" -1 11 1 {CSTYLE "" -1 -1 "Times" 1 12 0 0 0 1 2 2 2 2 2 2 1 1 1 1 }3 3 0 0 0 0 1 0 1 0 2 2 0 1 }{PSTYLE "Maple Out put" -1 12 1 {CSTYLE "" -1 -1 "Times" 1 12 0 0 0 1 2 2 2 2 2 2 1 1 1 1 }1 3 0 0 0 0 1 0 1 0 2 2 0 1 }} {SECT 0 {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 1129 "################## ############# \n# printPrisms : Print s-prism and p-prism together \n# ############################### \nprintPrisms := proc(s_prism, p_prism , name) \n local i,j,k; \n\n printf(\"\\n%s\\n\",name); \n printf(\"|------------------| |------------------|\\n\"); \+ \n for j to N do \n printf(\"||---------------- || ||----------------||\\n\"); \n for k to Ni do \n printf(\"||\"); \n for i \+ to N do \n cc := subs(t=2, s_prism[i,j,N i+1-k]); \n printf(\"%3d,\",cc ); \n \+ end do; \n printf(\"||\");\n \n printf(\" \");\n\n \+ printf(\"||\"); \n for i to N do \n \+ printf(\"%3d,\",p_prism[i,j,Ni+1-k]); \n \+ end do; \n printf(\"||\\n\"); \n \+ end do; \n\n end do; \n printf(\"||------------ ----|| ||----------------||\\n\"); \n printf(\"|----------- -------| |------------------|\\n\"); \nend proc;" }}{PARA 7 "" 1 "" {TEXT -1 70 "Warning, `cc` is implicitly declared local to procedur e `printPrisms`\n" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 705 "##### ########################## \n# printPrism : Print any prism which cont ains integers \n################################ \nprintPrism := proc( prism, name) \n local i,j,k; \n\n printf(\"\\n%s\\n\",name ); \n printf(\"|------------------|\\n\"); \n for j to \+ N do \n printf(\"||----------------||\\n\"); \n \+ for k to Ni do \n printf(\"||\"); \n \+ for i to N do \n printf (\"%3d,\",prism[i,j,Ni+1-k]); \n end do; \n \+ printf(\"||\\n\"); \n end do; \n\n \+ end do; \n printf(\"||----------------||\\n\"); \n prin tf(\"|------------------|\\n\"); \nend proc;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 769 "############################### \n# printsPrism : Print sPrism in pretty format \n################################ \n printsPrism := proc(prism,name) \n local i,j,k,cc; \n\n pr intf(\"\\n%s\\n\",name); \n printf(\"|------------------|\\n\"); \n for j to N do \n printf(\"||--------------- -||\\n\"); \n for k to Ni do \n \+ printf(\"||\"); \n for i to N do \+ \n cc := subs(t=2, prism[i,j,Ni+1-k]); \+ \n printf(\"%3d,\",cc ); \n \+ end do; \n printf(\"||\\n\"); \n \+ end do; \n end do; \n printf(\"||---------------- ||\\n\"); \n printf(\"|------------------|\\n\"); \nend proc; " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 366 "######################## ########## \n# num2poly :Converts Number to a Polynomial \n########### ###################### \n\nnum2poly := proc(n) \n\nlocal i,a,p,temp, c arry, test; \n\na := 0; \n\ntemp := n; \ni:=1; \nwhile temp<>0 do \n \+ p := irem(temp,2); \n if (p <> 0 ) then \n a := a + t^(i-1) ; \n fi; \n temp := iquo(temp,2); \n i := i+1; \nod; \nretu rn(a); \nend;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 264 "######### ######################## \n# bin2poly : Converts Binary Number to a Po lynomial \n################################# \n\nbin2poly := proc(word , wsize) \n\nlocal temp,i; \ntemp := 0; \n\nfor i to wsize do \n te mp := temp + word[i]*t^(i-1); \nod; \n\nreturn temp; \nend;" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 276 "########################### ####### \n# poly2bin : Converts a Polynomial to Binary Number \n###### ########################### \n\npoly2bin := proc(poly, pdeg) \nlocal t emp,i; \n\ntemp := Array(1..pdeg+1); \nfor i to pdeg+1 do \n temp[i ] := coeff(poly,t,i-1); \nod; \nreturn temp; \nend;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 349 "################################### \n# \+ vec2num : Converts a Vector to Binary Number \n####################### ########## \n\nvec2num := proc(n_vec, n_sz) \nlocal i,a,size_n,p,temp, carry, test; \n\na := Array(1..n_sz); \n\ntemp := 0; \n\nfor i to n_s z do \n #temp := temp + n_vec[513-i]*2^(i-1); \n temp := temp + n_ vec[i]*2^(i-1); \nod; \n\nreturn(temp); \nend;" }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 410 "################################## \n# num2ve c : Converts a Number to a Vector \n################################# \+ \n\nnum2vec := proc(n, n_sz) \nlocal i,a,size_n,p,temp, temp1, test; \+ \n\na := array(1..n_sz); \ntemp1 := array(1..n_sz); \n\ntemp := n; \n i:=1; \nfor i to n_sz do \n p := irem(temp,2); \n temp1[i] := p; \+ \n temp := iquo(temp,2); \nod;\n\nfor i to n_sz do \n a[i] := temp 1[n_sz-i+1]; \nod;\n \nreturn(a); \nend;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 264 "################################## \n# setzero : Ini tilialize f_coeff and sets Zero \n# 3. Dimension version \n########### ###################### \n\nsetzero := proc() \n local i,j,k,f_co ef; \n\n f_coef := Array(1..N,1..N,1..Ni); \n\n return (f_ coef); \nend;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 241 "######### ######################### \n# setone : Initilialize f_coeff and sets Z ero \n################################# \n\nsetone := proc(n) \n \+ local i,j,k,f_coef; \n\n f_coef := Array(1..n,1..n, fill=1); \n \n return (f_coef); \nend;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 48 "#for i to 15 do \n#print(convert(i,binary));\n#od;" } }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 553 "######################### ######### \n# map_prism : Maps prism \n############################### ## \n\nmap_prism := proc(n) \nlocal i,j,k,a,p,temp, carry, test, Base; \n\na := Array(1..N,1..N,1..Ni); \np_reverse := array(1..16,[0,8,4,12 ,2,10,6,14,1,9,5,13,3,11,7,15]);\nBase := 2^4; \ntemp := n; \ncarry := 0; \n\nfor i to N do \n for j to N do \n for k to Ni do \n \+ p := irem(temp,Base); \n #print(convert(p,binary)); \n \+ temp := iquo(temp,Base); \n a[i,j,k] := num2poly(p_reverse[p+1 ],4); \n od; \n od; \nod; \n#print(a); \nreturn(a); \nend;" }} {PARA 7 "" 1 "" {TEXT -1 75 "Warning, `p_reverse` is implicitly declar ed local to procedure `map_prism`\n" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 357 "################################## \n# map_num : Map s prism to number \n################################# \n\nmap_num := p roc(n_prism) \nlocal i,j,k,sum, Base; \n\nBase := 2^4; \n\nsum := 0; \+ \nfor i to N do \n for j to N do \n for k to Ni do \n sum \+ := sum + 16^((i-1)*Ni*N + (j-1)*Ni + k-1)*subs(t=2,n_prism[i,j,k]); \n od; \n od; \nod; \nreturn(sum); \nend;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 1204 "################################## \n# perm_in itial :initilaize p_prism \n################################# \n\nperm _initial := proc(s_prism) \nlocal i,j,k,ti,tj,p_prism,tmp; \n\np_prism := Array(1..N, 1..N, 1..Ni); \n\n# this can be precomputed table \n# \+ \n# set the random permutation \n#printf (\"\\n perm_initial : Random \+ permutation part\\n\"); \nfor i from 1 to N do \n for j from 1 to N do \n for k from 1 to Ni do \n p_prism[i,j,k] := Ni*N*(i-1 ) + Ni*(j-1) + k-1; \n #printf (\"* %d \" , p_prism[i,j,k]); \+ \n od; \n od; \nod; \n\n# print initial s_prism and p_prism\nif ( PRINT_LEVEL1 = 1) then\n printPrisms(s_prism, p_prism,\"map s_prism \+ and p_prism= \"); \nend;\n\n# this part cannot be precomputed table \n # if s_prims is not constant \n# \n#printf (\"\\n perm_initial : mixer part\\n\"); \nfor i from 1 to N do \nfor j from 1 to N do \n for k \+ from 1 to Ni do \n tmp := subs(t=2, s_prism[i,j,k]); \n #prin tf (\"_%d\", tmp); \n ti := irem(tmp,4) + 1; \n tj := iquo(tmp,4 ) + 1; \n tmp := p_prism[i,j,k]; \n p_prism[i,j,k] := p_prism[ti ,tj,k]; \n p_prism[ti,tj,k] := tmp; \n #printf (\"\\n%d=%d_%d_%d ~%d_%d - \" , tmp,ti,tj,k,p_prism[i,j,k],p_prism[ti,tj,k]); \nod;od; od; \n\nreturn p_prism; \n\nend;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14115 "################################## \n# dim3_fft 3. Dimensional FFT and apply effects on p_prism \n###################### ########### \n\ndim3_fft := proc(time_coef, p_prism) \n\nlocal f_coef, temp,i,j,k,l,tmp_coef, idx, cntr_plane, nxt_cntr_plane, cntr_plane_L, \+ cntr_plane_H; \nglobal N, Modulus; \n\nf_coef := Array(1..N, 1..N, 1.. Ni); \n\ncntr_plane := Array(1..N,1..Ni); \ncntr_plane_L := Array(1 ..N,1..N); \ncntr_plane_H := Array(1..N,1..N); \nnxt_cntr_plane := Arr ay(1..N,1..N); \n\n#f_coef := setzero(); #### since we use array \n\n \n# choose and set the swap control plane through k-axis \nplane_idx : = 1; \nplane_idx1 := 5; \n\n########################################## ###################################################### \nfor i from 1 \+ to N do \n for j from 1 to N do \n cntr_plane_L[i,j] := time_coef [i,j,plane_idx]; \n cntr_plane_H[i,j] := time_coef[i,j,plane _idx1]; \n nxt_cntr_plane[i,j] := time_coef[i,j,plane_idx+1] + tim e_coef[i,j,plane_idx1+1] mod 2; \n od; \nod; \n\nif (PRINT_LEVEL2 = 1 ) then\n print(\"cntr_plane_L\",cntr_plane_L); \n print(\"cntr_pla ne_H\",cntr_plane_H); \n print(\"2nd_cntr_plane\",nxt_cntr_plane); \+ \nfi;\n#print(plane_idx,\"1\",p_prism); \n\n########################## ###################################################################### \n#printPrism(p_prism,\"pPrism before first swappings\"); \n\nfor i f rom 1 to N do \n for j from 1 to N do \n\n ##################### ############################################# \n # level 1 \+ - (swap-1) \n if (coeff(cntr_plane_L[i,j],t,0) = 0) then \+ \n tmp := p_prism[i,j,1]; \n p_prism[i,j, 1] := p_prism[i,j,2]; \n p_prism[i,j,2] := tmp; \n \+ fi; \n #printf (\"\\n cntr L 0 = %d\",coeff(cntr_plane_L[ i,j],t,0)); \n\n # level 1 (swap-2) \n if (coeff (cntr_plane_L[i,j],t,1) = 0) then \n tmp := p_prism[i,j, 3]; \n p_prism[i,j,3] := p_prism[i,j,4]; \n \+ p_prism[i,j,4] := tmp; \n fi; \n #printf (\"\\n \+ cntr L 1 = %d\",coeff(cntr_plane_L[i,j],t,1)); \n\n # level 1 (swap-5) \n if (coeff(cntr_plane_H[i,j],t,0) = 0) then \+ \n tmp := p_prism[i,j,5]; \n p_prism[i,j ,5] := p_prism[i,j,6]; \n p_prism[i,j,6] := tmp; \n \+ fi; \n #printf (\"\\n cntr H 0 = %d\",coeff(cntr_plane_H [i,j],t,0)); \n\n # level 1 (swap-6) \n if (coef f(cntr_plane_H[i,j],t,1) = 0) then \n tmp := p_prism[i, j,7]; \n p_prism[i,j,7] := p_prism[i,j,8]; \n \+ p_prism[i,j,8] := tmp; \n fi; \n #printf (\"\\n cntr H 1 = %d\",coeff(cntr_plane_H[i,j],t,1)); \n\n ########### ####################################################### \n \+ # level 2 (swap-3) \n if (coeff(cntr_plane_L[i,j],t ,2) = 0) then \n tmp := p_prism[i,j,2]; \n \+ p_prism[i,j,2] := p_prism[i,j,3]; \n p_prism[i,j,3] \+ := tmp; \n fi; \n #printf (\"\\n cntr L 2 = %d\",coef f(cntr_plane_L[i,j],t,2)); \n\n # level 2 (swap-4) \n \+ if (coeff(cntr_plane_L[i,j],t,3) = 0) then \n tmp \+ := p_prism[i,j,1]; \n p_prism[i,j,1] := p_prism[i,j,4]; \+ \n p_prism[i,j,4] := tmp; \n fi; \n #pr intf (\"\\n cntr L 3 = %d\",coeff(cntr_plane_L[i,j],t,3)); \n\n \+ # level 2 (swap-7) \n if (coeff(cntr_plane_H[i,j],t,2) = 0) then \n tmp := p_prism[i,j,6]; \n p _prism[i,j,6] := p_prism[i,j,7]; \n p_prism[i,j,7] := t mp; \n fi; \n #printf (\"\\n cntr H 2 = %d\",coeff(cn tr_plane_H[i,j],t,2)); \n\n # level 2 (swap-8) \n \+ if (coeff(cntr_plane_H[i,j],t,3) = 0) then \n tmp := \+ p_prism[i,j,5]; \n p_prism[i,j,5] := p_prism[i,j,8]; \n p_prism[i,j,8] := tmp; \n fi; \n #pri ntf (\"\\n cntr H 3 = %d\",coeff(cntr_plane_H[i,j],t,3)); \n\n # printPrism(p_prism,\"pPrism before level 3swappings\"); \n\n ### ############################################################### \n \+ # level 3 (swap-9) \n if (coeff(nxt_cntr_plane[i,j], t,0) = 0) then \n tmp := p_prism[i,j,1]; \n \+ p_prism[i,j,1] := p_prism[i,j,8]; \n p_prism[i,j,8] := tmp; \n fi; \n #printf (\"\\n nxt_cntr 0 = %d\",c oeff(nxt_cntr_plane[i,j],t,0)); \n\n # level 3 (swap-10) \n if (coeff(nxt_cntr_plane[i,j],t,1) = 0) then \n \+ tmp := p_prism[i,j,2]; \n p_prism[i,j,2] := p_pris m[i,j,7]; \n p_prism[i,j,7] := tmp; \n fi; \+ \n #printf (\"\\n nxt_cntr 1 = %d\",coeff(nxt_cntr_plane[i,j],t, 1)); \n\n # level 3 (swap-11) \n if (coeff(nxt_c ntr_plane[i,j],t,2) = 0) then \n tmp := p_prism[i,j,3]; \n p_prism[i,j,3] := p_prism[i,j,6]; \n \+ p_prism[i,j,6] := tmp; \n fi; \n #printf (\"\\n nxt_ cntr 2 = %d\",coeff(nxt_cntr_plane[i,j],t,2)); \n\n # level 3 (swap-12) \n if (coeff(nxt_cntr_plane[i,j],t,3) = 0) the n \n tmp := p_prism[i,j,4]; \n p_prism[i ,j,4] := p_prism[i,j,5]; \n p_prism[i,j,5] := tmp; \n \+ fi; \n #printf (\"\\n nxt_cntr 3 = %d\",coeff(nxt_cntr _plane[i,j],t,3)); \n\n #printPrism(p_prism,\"pPrism after level 3swappings\"); \n od; \nod; \n#printPrism(p_prism,\"pPrism after fir st swappings\"); \n#print(plane_idx,\"1\",p_prism); \n\n############## ###################################################################### ############ \n# compute transform - first iteration through k-axis \n for i from 1 to N do \n for j from 1 to N do \n for k from 1 to Ni do \n for l from 1 to Ni do \n f_coef[i, j, k] := f_coef[i, j, k] + Fi_matrix[k,l]*subs(t=2, time_coef[i, j, l]) mo d Modulus; \n #f_coef[i, j, k] := rem(f_coef[i, j, k] + r em( F_matrix[k,l]*time_coef[i, j, l], defPoly,t), defPoly,t) mod 2; \n od; \n #f_coef[i, j, k] := num2poly(f_coef[i, j, k],5); \n od; \n od; \nod; \n\n####################################### ######################################################### \nif (PRINT_ LEVEL1 = 1) then\n printPrisms(f_coef,p_prism,\"s_prism after first \+ DFT iteration through k-axis and p_prism after 1st and 2nd swappings\" ); \nend;\n########################################################### ##################################### \n\n#print(\"1\",f_coef); \ntmp_ coef := f_coef; \n#print(\"n1\",tmp_coef); \nf_coef := setzero(); \+ ########## setZero here ###################### \n#print(\"n2\",tmp_ coef); \n\n#break; \n\n############################################### ################################################# \n# rotate the plane and set the swap table (p_prism_plane) j-axis \nplane_idx := plane_id x mod N + 1; \nfor i from 1 to N do \n for k from 1 to Ni do \+ \n ### @note in the below line num2poly called with two argument that the second have no effect on the funtion. so removed \n \+ #idx := num2poly((k-1)+ Ni*(i-1),4);# add idx for balance \+ \n #cntr_plane[i,k] := num2poly(tmp_coef[i, plane_idx,k] ,4) + idx mod 2; \n\n idx := num2poly((k-1)+ Ni*(i-1)); \+ \n cntr_plane[i,k] := num2poly(tmp_coef[i, plane_idx,k]) + idx mod 2; \n od; \nod;\nif (PRINT_LEVEL2 = 1) then \n print(\"3 rd cntr_plane\",cntr_plane); \nfi;\n################################## ############################################################## \n\n#pr intf (\"\\n -> %d \",plane_idx-1 mod N +1); \n#printf (\"\\n - > %d \",plane_idx mod N +1); \n#printf (\"\\n -> %d \",plane _idx+1 mod N +1); \n#printf (\"\\n -> %d \",plane_idx+2 mod N +1); \nf or i from 1 to N do \n for k from 1 to Ni do \n # level 1 (swap-1) \+ \n #printf (\"\\n%d %d = %d\",i,k,coeff(cntr_plane[i,k],t,0)); \+ \n if (coeff(cntr_plane[i,k],t,0) = 0) then \n tmp := p_pris m[i,plane_idx-1 mod N + 1,k]; \n p_prism[i,plane_idx-1 mod N + 1,k] := p_prism[i,plane_idx mod N + 1,k]; \n p_prism[i,plane_i dx mod N + 1,k] := tmp; \n fi; \n # level 2 (swap-2) \n #p rintf (\"\\n%d %d = %d\",i,k,coeff(cntr_plane[i,k],t,1)); \n if (co eff(cntr_plane[i,k],t,1) = 0) then \n tmp := p_prism[i,plane_id x+1 mod N + 1,k]; \n p_prism[i,plane_idx+1 mod N + 1,k] := p_ prism[i,plane_idx+2 mod N + 1,k]; \n p_prism[i,plane_idx+2 mod N + 1,k] := tmp; \n fi; \n # level 2 (swap-3) \n #printf (\"\\n%d %d = %d\",i,k,coeff(cntr_plane[i,k],t,2)); \n if (coeff(c ntr_plane[i,k],t,2) = 0) then \n tmp := p_prism[i,plane_idx mod N + 1,k]; \n p_prism[i,plane_idx mod N + 1,k] := p_prism[i,p lane_idx+1 mod N + 1,k]; \n p_prism[i,plane_idx+1 mod N + 1,k ] := tmp; \n fi; \n # level 1 (swap-4) \n #printf (\"\\n%d %d = %d\",i,k,coeff(cntr_plane[i,k],t,3)); \n if (coeff(cntr_plane [i,k],t,3) = 0) then \n tmp := p_prism[i,plane_idx-1 mod N + 1 ,k]; \n p_prism[i,plane_idx-1 mod N + 1,k] := p_prism[i,plane_ idx+2 mod N + 1,k]; \n p_prism[i,plane_idx+2 mod N + 1,k] := \+ tmp; \n fi; \nod;od; \n\n#print(plane_idx,\"1\",p_prism); \n\n#prin tPrism(p_prism,\"p_prism after rotating the plane and setting the swap table\"); \n\n####################################################### ######################################### \n# compute transform - seco nd iteration through j-axis \n\nfor i from 1 to N do \n for k from 1 \+ to Ni do \n for j from 1 to N do \n for l from 1 to N do \n #f_coef[i, j, k] := rem(f_coef[i, j, k] + rem( F_matrix[j,l ]*tmp_coef[i, l, k], defPoly,t), defPoly,t) mod 2; \n f_coef [i, j, k] := f_coef[i, j, k] + F_matrix[j,l]*tmp_coef[i, l, k] mod Mod ulus; \n od; \n #f_coef[i, j, k] := num2poly(f_coef[i, j , k],5); \n od; \n od; \nod; \n\n################################ ################################################################ \nif \+ (PRINT_LEVEL1 = 1) then\n printPrisms(f_coef,p_prism,\"s_prism after second DFT iteration through j-axis and p_prism after third swapping \"); \nend;\n######################################################### ####################################### \n\ntmp_coef := f_coef; \n#pri nt(\"1n\",tmp_coef); \nf_coef := setzero(); \n#print(\"2n\",tmp_coef); \n\n#break; \n\n##################################################### ########################################### \n# choose and set the swa p control plane through i-axis \nfor j from 1 to N do \n for k from 1 to Ni do \n idx := num2poly((k-1)+ Ni*(j-1),4);# add idx for bala nce \n #print(j,k,\" => \",idx, plane_idx); \n cntr_plane[j, k] := num2poly(tmp_coef[plane_idx,j,k],4)+idx mod 2; \n od; \nod;\nif (PRINT_LEVEL2 = 1) then \n print(\"4th cntr_plane\",cntr_plane); \n fi;\n################################################################# ############################### \n#start swaping p_prism \nfor j from \+ 1 to N do \n for k from 1 to Ni do \n # swap-1 \n if (coeff(cntr _plane[j,k],t,0) = 0) then \n tmp := p_prism[plane_idx-1 mod N \+ + 1,j,k]; \n p_prism[plane_idx-1 mod N + 1,j,k] := p_prism[pla ne_idx mod N + 1,j,k]; \n p_prism[plane_idx mod N + 1,j,k] := t mp; \n fi; \n # swap-2 \n if (coeff(cntr_plane[j,k],t,1) = 0) then \n tmp := p_prism[plane_idx+1 mod N + 1,j,k]; \n \+ p_prism[plane_idx+1 mod N + 1,j,k] := p_prism[plane_idx+2 mod N + 1, j,k]; \n p_prism[plane_idx+2 mod N + 1,j,k] := tmp; \n fi; \+ \n # swap-3 \n if (coeff(cntr_plane[j,k],t,2) = 0) then \n \+ tmp := p_prism[plane_idx mod N + 1,j,k]; \n p_prism[plane_id x mod N + 1,j,k] := p_prism[plane_idx+1 mod N + 1,j,k]; \n p_ prism[plane_idx+1 mod N + 1,j,k] := tmp; \n fi; \n # swap-4 \n \+ if (coeff(cntr_plane[j,k],t,3) = 0) then \n tmp := p_prism[p lane_idx-1 mod N + 1,j,k]; \n p_prism[plane_idx-1 mod N + 1,j ,k] := p_prism[plane_idx+2 mod N + 1,j,k]; \n p_prism[plane_id x+2 mod N + 1,j,k] := tmp; \n fi; \nod;od; \n#printPrism(p_prism, \"p_prism after rotating i axis the plane and setting the swap table\" ); \n\n#print(plane_idx,\"1\",p_prism); \n\n#break; \n################ ###################################################################### ########## \n# compute transform - third iteration i-axis \nfor j from 1 to N do \n for k from 1 to Ni do \n for i from 1 to N do \n \+ for l from 1 to N do \n #f_coef[i, j, k] := rem(f_coef[ i, j, k] + rem( F_matrix[i,l]*tmp_coef[l, j, k], defPoly,t), defPoly,t ) mod 2; \n f_coef[i, j, k] := f_coef[i, j, k] + F_matrix[i, l]*tmp_coef[l, j, k] mod Modulus; \n od; \n od; \n od; \no d; \n\n############################################################### ################################# \nif (PRINT_LEVEL1 = 1) then\n pri ntPrisms(f_coef,p_prism,\"s_prism after 3rd DFT iteration through i-ax is and p_prism after 4th swapping\"); \nend;\n######################## ###################################################################### ## \n\ntest_coef := dim3_fft_inv(f_coef); \nif (PRINT_LEVEL1 = 1) then \n printPrisms(test_coef,p_prism,\"test DFT must match with s=prism \+ after affine transform\"); \nend;\n\nfor j from 1 to N do \n for k fr om 1 to Ni do \n for i from 1 to N do \n idx := iquo((k-1)+ \+ Ni*(j-1)+Ni*N*(i-1),16);# add idx for balance \n #printf (\"\\n% d %d %d = > %d \" , j-1,k-1,i-1,idx); \n p_prism_L[i, j, k] := r em(t^7*(iquo(f_coef[i, j, k],16)+idx mod 2) + num2poly(p_prism[i, j, k ],7),t^4,t) mod 2; \n p_prism_H[i, j, k] := quo(t^7*(iquo(f_coef [i, j, k],16)+idx mod 2) + num2poly(p_prism[i, j, k],7),t^4,t) mod 2; \+ \n od; \n od; \nod; \n#printsPrism(p_prism_L,\"p_prism_L after fi rst iteration through i-axis\"); \n#printsPrism(p_prism_H,\"p_prism_H \+ after first iteration through i-axis\"); \n########################### ##################################################################### \+ \n# We do not keep data in poly form. this era is skipped \n########## ###################################################################### ################ \nfor j from 1 to N do \n for k from 1 to Ni do \n \+ for i from 1 to N do \n f_coef[i, j, k] := num2poly(f_c oef[i, j, k],4); \n od; \n od; \nod; \n\n#print(\"trans\",f_coef) ; \n\nRETURN (f_coef, p_prism, p_prism_H, p_prism_L); \nend;" }} {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}{PARA 7 "" 1 "" {TEXT -1 74 "War ning, `plane_idx` is implicitly declared local to procedure `dim3_fft` \n" }}{PARA 7 "" 1 "" {TEXT -1 75 "Warning, `plane_idx1` is implicitly declared local to procedure `dim3_fft`\n" }}{PARA 7 "" 1 "" {TEXT -1 68 "Warning, `tmp` is implicitly declared local to procedure `dim3_fft `\n" }}{PARA 7 "" 1 "" {TEXT -1 74 "Warning, `test_coef` is implicitly declared local to procedure `dim3_fft`\n" }}{PARA 7 "" 1 "" {TEXT -1 74 "Warning, `p_prism_L` is implicitly declared local to procedure `di m3_fft`\n" }}{PARA 7 "" 1 "" {TEXT -1 74 "Warning, `p_prism_H` is impl icitly declared local to procedure `dim3_fft`\n" }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 2865 "################################## \n# dim3_ fft_inv :3. Dimensional inverse FFT \n################################ # \n\ndim3_fft_inv := proc(f_coef) \n\nlocal temp1,i, j, k,l, time_co ef, sum,temp,index,tmp_coef; \nglobal N, Modulus;\n\nL_INV := N^(-1) m od Modulus; \nLi_INV := Ni^(-1) mod Modulus; \n\ntime_coef := Array(1. .N,1..N,1..Ni); #### last bounf was set to N changed to Ni \nindex := \+ simplify(log[2](Base)); \n#print(f_coef); \n\n#time_coef := setzero (); #### We use Array no need anymore \n\n# compute transform - third iteration \nfor k from 1 to Ni do \n for j from 1 to N do \n for i from 1 to N do \n tmp_coef[i, j, k] :=L_INV*f_coef[i, j, k] \+ mod Modulus\n od; \n od; \nod; \n\nfor k from 1 to Ni do \n for \+ j from 1 to N do \n for i from 1 to N do \n for l from 1 to N do \n time_coef[i, j, k] := time_coef[i, j, k] + F_inv_ma trix[i,l]*tmp_coef[l, j, k] mod Modulus; \n #time_coef[i, j, k] := rem(time_coef[i, j, k] + rem(F_inv_matrix[i,l]*f_coef[l, j, k], defPoly,t), defPoly,t) mod 2; \n od; \n od; \n od; \nod; \+ \n\n#tmp_coef := time_coef; \n\n# compute transform - second iteration \nfor k from 1 to Ni do \n for j from 1 to N do \n for i from 1 \+ to N do \n tmp_coef[i, j, k] := L_INV*time_coef[i, j, k] mod Mo dulus\n od; \n od; \nod; \n\ntime_coef := setzero(); \n\nfor i fr om 1 to N do \n for k from 1 to Ni do \n for j from 1 to N do \n \+ for l from 1 to N do \n time_coef[i, j, k] := time_co ef[i, j, k] + F_inv_matrix[j,l]*tmp_coef[i, l, k] mod Modulus; \n \+ #time_coef[i, j, k] := rem(time_coef[i, j, k] + rem( F_inv_matri x[j,l]*tmp_coef[i, l, k], defPoly,t), defPoly,t) mod 2; \n od; \+ \n od; \n od; \nod; \n\n# compute transform - first iteration \nf or k from 1 to Ni do \n for j from 1 to N do \n for i from 1 to N do \n tmp_coef[i, j, k] := Li_INV*time_coef[i, j, k] mod Modul us\n od; \n od; \nod; \n\ntime_coef := setzero(); \n\nfor i from \+ 1 to N do \n for j from 1 to N do \n for k from 1 to Ni do \n \+ for l from 1 to Ni do \n time_coef[i, j, k] := time_coef [i, j, k] + Fi_inv_matrix[k,l]*tmp_coef[i, j, l] mod Modulus; \n \+ #time_coef[i, j, k] := rem(time_coef[i, j, k] + rem(F_inv_matrix[ k,l]*tmp_coef[i, j, l], defPoly,t), defPoly,t) mod 2; \n od; \n od; \n od; \nod; \n\n\n#for j from 1 to N do \n# for k from 1 \+ to N do \n# time_coef[j] := rem(time_coef[j] + rem( F_inv_matrix[ j,k]*f_coef[k]*L_INV, defPoly,t), defPoly,t) mod 2; \n# od; \n#od; \+ \n\n#sum := 0; \n#for i from 1 to N do \n# #temp := time_coef[i]; \n # if (quo(time_coef[i],t^(N-2),t) = 1) then \n# time_coef[i] := (defPoly+time_coef[i]) mod 2; \n# fi; \n# sum := expand(sum + t ime_coef[i]*t^(index*(i-1))) mod 2; \n# #print(sort(sum)); \n#od; \n #print(sort(sum)); \n#temp := subs(t=2,sum); \n#print(time_coef); \n#p rint(\"Integer => \",temp); \n\nRETURN(time_coef); \n \nend;" }} {PARA 7 "" 1 "" {TEXT -1 74 "Warning, `L_INV` is implicitly declared l ocal to procedure `dim3_fft_inv`\n" }}{PARA 7 "" 1 "" {TEXT -1 75 "War ning, `Li_INV` is implicitly declared local to procedure `dim3_fft_inv `\n" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 585 "################### ############### \n# affine_trans_entry : Affine transformation for ent ries of s_prism \n################################# \n\naffine_trans_e ntry := proc(poly) \nlocal alfa, gama,deg,tmp,i,j,out; \n\nalfa := Arr ay(1..4,1..4,[[1,0,1,1],[1,1,0,1],[1,1,1,0],[0,1,1,1]]); \ngama := [1, 1,1,0]; \n\n#print(alfa);\ndeg := 3; \nout := Array(1..deg+1,[0,0,0,0] ); \n\ntmp := poly2bin(poly, deg);#print(tmp); \n\nfor i to deg+1 do \+ \n for j to deg+1 do \n out[i] := out[i] + tmp[j]*alfa[i,j] mod 2 ; \n od; \n out[i] := out[i] + gama[i] mod 2; \nod; \n#print(out);\n return(bin2poly(out,4)); \nend;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 697 "#test affine for fixed points \nalfa := Array(1..4,1..4,[[1,0 ,1,1],[1,1,0,1],[1,1,1,0],[0,1,1,1]]);\ntmp := 0; \nfor j from 1 to 1 \+ do \ngama := num2vec(7,4); \nprint(\"j\",j,gama); \nfor i from 0 to 15 do \n ##res := affine_trans_entry(rem(num2poly(i)^14, defPoly,t) mod 2, gama); \n ##if (num2poly(i)= res) then \n ## print(\"fix\",j,i ,num2poly(i), res); \n ##end; \n ##if (num2poly(i)= res+t^4+defPoly \+ mod 2) then \n ## print(\"oix\",j,i,num2poly(i), res+t^4+defPoly mo d 2 ); \n ##end; \n\n ##tmp := affine_trans_entry(rem(tmp^14, defPol y,t) mod 2, gama); \n ##print(i,subs(t=2,tmp)); \n \n # tmp := affine_trans_entry (rem(num2poly(i)^14, defPoly,t) mod 2); \n # \+ print(i,subs(t=2,tmp)); \nod;od;" }}{PARA 11 "" 1 "" {XPPMATH 20 "6%Q \"j6\"\"\"\"-%'vectorG6#7&\"\"!F%F%F%" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 550 "################################## \n# affine_trans \+ : Affine transformation \n################################# \n\naffine _trans := proc(a) \nlocal i,j,k, c_coef; \nglobal N, Modulus; \n\nc_co ef := Array(1..N, 1..N, 1..Ni); \n\nfor i from 1 to N do \n for \+ j from 1 to N do \n for k from 1 to Ni do \n \+ #c_coef[i, j, k] := affine_trans_entry(rem(a[i, j, k], defP oly,t) mod 2) ; \n c_coef[i, j, k] := affine_tra ns_entry(a[i, j, k]) ; \n od; \n od; \nod ; \n\nRETURN(c_coef); \nend;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 1257 "################################## \n# xinv_func : The X inver se funtion \n################################# \n\nxinv_func := proc(a ) \n\n local i,j,k, c_coef, preTable,Base,tmp,p,test; \n g lobal N, Modulus; \n \n Base = 2^4; \n c_coef := Ar ray(1..N, 1..N, 1..Ni); \n preTable := Array(1..16); \n\n \+ for k to 16 do \n preTable[k] := rem((num2poly(k-1,4))^1 4, defPoly,t) mod 2; \n tmp := subs(t=2, preTable[k]); \+ \n #print (\"----\", k, \" = \", tmp); \n od; \n\n for i from 1 to N do \n for j from 1 to N do \+ \n for k from 1 to Ni do \n \+ tmp := subs(t=2, a[i,j,k]); \n \+ test := preTable[tmp+1 ]; \n c_co ef[i, j, k] := test; \n #printf(\"+%d\", tmp); \n #c_coef[i, j, k] := rem(a[i, j, k]^14, defPoly,t) mod 2; \n #print(\"Va lues >> \", test , c_coef[i, j, k]); \n \+ #print (\" << c := \", c_coef[i, j, k], \">> a := \", a[i, j, k], \"d ef := \", defPoly); \n od; \n \+ od; \n od; \n\n RETURN(c_coef); \nend;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 598 "################################## \n# prism_add : Addition over prism \n############################### ## \n\nprism_add := proc(a,b) \nlocal i,j,k, c_coef; \nglobal N, Modul us; \n\nc_coef := Array(1..N, 1..N, 1..Ni); \n\nfor i from 1 to N do \+ \n for j from 1 to N do \n for k from 1 to Ni do \n c_coef [i, j, k] := rem(a[i, j, k]+b[i, j, k], defPoly,t) mod 2 ; \n # print(a[i, j, k]+b[i, j, k], \"<=>\",c_coef[i, j, k] \+ ); \n od; \n od; \nod; \n\n#for i from 0 to 50 do \n# prin t ( i, \" <=> \" , subs(t=2, rem (num2poly(i), defPoly,t) mod 2)); \n# od; \n\nRETURN(c_coef); \nend; \n\n" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 688 "################################## \n# Rubic rotatio n : rotations on p_prism\n################################# \n\nRubic_ rot := proc(p_prism) \nlocal i,j,k, c_coef,p; \nglobal N, Modulus; \n \nc_coef := setzero(); ###### set zero here ####### \n\nfor i from 1 \+ to N do \n for j from 1 to N do \n for k from 1 to Ni do\n \+ if (k mod 4 = 0) then \n c_coef[i, j, k] := p_prism[i, j, k ];\n elif (k mod 4 = 1) then\n c_coef[i, j, k] := p_pr ism[5-j, i, k];\n elif (k mod 4 = 2) then\n c_coef[i, \+ j, k] := p_prism[j, i, k];\n elif (k mod 4 = 3) then\n \+ c_coef[i, j, k] := p_prism[j, 5-i, k];\n fi;\n od; \n od; \nod; \n \nRETURN(c_coef); \nend;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 467 "################################## \n# PermS : Permu tation substitution \n################################# \n\nPermS := p roc(a, rperm) \nlocal i,j,k, c_coef,p; \nglobal N, Modulus; \n\nc_coef := setzero(); ###### set zero here ####### \n\nfor i from 1 to N do \+ \n for j from 1 to N do \n for k from 1 to Ni do \n p := r perm[i,j,k]; \n c_coef[i, j, k] := a[iquo(p-1,32) mod 4 +1, iqu o(p-1,4) mod 4 +1, p-1 mod 8+1]; \n od; \n od; \nod; \n \nRETURN( c_coef); \nend;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 953 "####### ########################### \n# sel_Hash_bits : select final hash bits on s_prism \n################################# \n\nsel_Hash_bits := p roc(s, mask) \nlocal i, mask_num, s_entry, mask_table, mask_deg;\nmask _num := subs(t=2,mask);\n#print(%);\ns_entry := poly2bin(s, 4);\n\nmas k_table := array(1..16);\nmask_deg := array(1..15,[1,1,2,1,5,2,3,1,9,1 0,11,2,13,3,4]);\n\nmask_table[1] := s_entry[1];\nmask_table[2] := s_e ntry[2];\nmask_table[3] := s_entry[1]+s_entry[2]*t;\nmask_table[4] := \+ s_entry[3];\nmask_table[5] := 0;\nmask_table[6] := s_entry[2]+s_entry[ 3]*t;\nmask_table[7] := s_entry[1]+s_entry[2]*t+s_entry[3]*t^2;\nmask_ table[8] := s_entry[4];\nmask_table[9] := 0;\nmask_table[10] := 0;\nma sk_table[11] := 0;\nmask_table[12] := s_entry[3]+s_entry[4]*t;\nmask_t able[13] := 0;\nmask_table[14] := s_entry[2]+s_entry[3]*t+s_entry[4]*t ^2;\nmask_table[15] := s_entry[1]+s_entry[2]*t+s_entry[3]*t^2+s_entry[ 4]*t^3;\n\nreturn (mask_table[mask_num],mask_deg[mask_num]);\nend;" }} }{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 1655 "######################### ######### \n# Hash generation : generates the final hash value uses fi nal s_prism and p_prism \n################################# \n\nHash_g en := proc(s_prism, p_prism, hash_len) \n#Hash_gen := proc(hash_len) \+ \nlocal mask, c_coef, str,num_str,gb,wt,i,j,k,sum,sum_b; \n\nc_coef := setzero(); ###### set zero here ####### \nmask := array(1..4,[0,0,0, 0]);\n\nnum_str := hash_len/32; #print(%);\n\n# fill the diagonal for \+ minimum 128bit hash\nfor i from 1 to 4 do \n mask[i] := 2^(i-1); \nod;\n\nstr := 4;\nfor i from 2 to 4 do \n if (str = num_str) then \+ break;fi;\n\n # fill the upper diagonals\n for j from i to 4 do \n mask[j-i+1] := mask[j-i+1] + 2^(j-1); \n str := str+1; \n \+ #print(num_str,str,i,j,mask);\n if (str = num_str) then break ;fi; \n od;\n if (str = num_str) then break;fi;\n # fill the low er diagonals \n for j from i to 4 do \n mask[j] := mask[j] + 2^ (j-i); \n str := str+1; \n #print(num_str,str,i,j,mask);\n \+ if (str = num_str) then #print(\"here\");\n break;fi; \n od ;\nif (str = num_str) then break;fi;\nod;\n\nfor i from 1 to 4 do \n \+ mask[i] := num2poly(mask[i]); \nod;\n\n#break;\n\nsum := 0; sum_b \+ := 0; \nfor i to N do \n for j to N do \n for k to Ni do\n \+ gb := sel_Hash_bits(s_prism[i,j,k],mask[p_prism[i,j,k] mod 4+1])[1]; \n wt := sel_Hash_bits(s_prism[i,j,k],mask[p_prism[i,j,k] mod 4 +1])[2];#print(%%,%);\n sum := (2^wt)*sum + subs(t=2,gb);\n \+ #print(sum);\n #print(convert(sum,binary));\n sum_b: = sum_b+wt; \n #sum := sum + (2^wt)^((i-1)*Ni*N + (j-1)*Ni + k -1)*subs(t=2,gb); \n od; \n od; \nod;\n#print(\"sum_b\",sum_b); \+ \nreturn(sum); \nend;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 5322 " ################################## \n# s_hash : Specral Hash Funtion \+ \n################################# \n\ns_hash := proc(message, mLen, \+ hash_len) \nlocal i, j, k, temp, temp2, mVec, ext_mVec, ext_mLen, hash , num_chnk, s_prism, sprime_prism, p_prism, p_prism_L, p_prism_H, nlst _op1, nlst_op2, nlst_op3, h; \n\np_prism := Array(1..N, 1..N, 1..Ni); \+ \n\n\n#Initialize variables: \nh := Array(1..N,1..N,1..Ni); \nhash := \+ 0; \n\n## Pre-processing: \n# - append the bit '1' to the message \n# \+ - append k bits '0', where k is the minimum number OF 0 such that the \+ resulting message \n# length (in bits) is congruent to 448 (mod 512 ) \n# - append length of message (before pre-processing), in bits, as \+ 64-bit big-endian integer \n\n#mLen := floor(log[2.](message))+1; \n#p rint(mLen); \next_mLen := mLen+64 + (512 - irem(mLen+64,512)); \nif (P RINT_LEVEL1 = 1) then \n print(\"xlen\", ext_mLen, mLen); \nend;\n\n # convert(message, decimal, hex) \nmVec := num2vec(message,mLen);#prin t(%);\next_mVec := array(1..ext_mLen);\ntemp2 := array(1..512);\nfor i to mLen do ext_mVec[i] := mVec[i]; od; \next_mVec[mLen+1] := 1;# set \+ to 1 \nfor i from mLen+2 to ext_mLen do ext_mVec[i] := 0; od;\nif (PRI NT_LEVEL1 = 1) then \n print(ext_mVec); \nend;\n\ntemp := num2vec(mL en, 64); \nfor i to 64 do \n ext_mVec[ext_mLen-64+i] := temp[i]; \nod; \nif (PRINT_LEVEL1 = 1) then\n print(ext_mVec); \nend;\n\n# P rocess the message in successive 512-bit chunks: \nnum_chnk := iquo(ex t_mLen, 512); \nif (PRINT_LEVEL1 = 1) then \n print(num_chnk); \nend ;\n\n#break;\n\n for i to num_chnk do\n printf(\"\\n\"); \n print(\"############\", \"chunk number = \",i , \"####### #####\");\n \n # map the chunk into the prism \n \+ for j to 512 do \n temp2[j] := ext_mVec[(i- 1)*512 + j]; \n od;\n #print(temp2);\n #pri nt(\"chunk's input message block\"); \n #print(convert(vec2nu m(temp2,512),hex)); \n\n s_prism := map_prism(vec2num(temp2,5 12)); \n\n if (i <> 1) then\n if (PRINT_LEVEL1 = \+ 1) then \n printPrisms(s_prism, p_prism,\"map s_prism a nd p_prism= \");\n end;\n fi; \n\n if (i = 1) then\n p_prism := perm_initial(s_prism); \n \+ #printPrism(p_prism,\"p_prism after initial permutation= \"); \n \+ fi;\n\n if (PRINT_LEVEL1 = 1) then \n Has h_gen(s_prism,p_prism,512);\n print(\"test Hash_gen(512bit ), just testing for correctness must give the input chunk back\",%,con vert(%,hex)); \n end;\n\n s_prism := xinv_func(s_pri sm); \n #printsPrism(s_prism,\"xInverted s_prism =\"); \n\n \+ s_prism := affine_trans(s_prism); \n if (PRINT_LEVEL1 = 1) then \n printPrisms(s_prism, p_prism,\"affine transf ormed s_prism and p_prism after initialization= \"); \n end; \n\n (sprime_prism, p_prism, p_prism_H, p_prism_L) := dim3_ff t(s_prism, p_prism); \n #printf(\"\\n\"); \n #print( \"the message after transformed to the fourier domain\"); \n \+ #printf(\"\\n\"); \n #print(X_i,rperm,rperm_poly_H,rperm_poly _L); \n\n\n # test dft \n #s_coef := dim3_fft_inv(X_ i,F_inv_matrix); \n #printf(\"\\n\"); \n #print(\"th e message after transformed to the time domain\"); \n #print( s_coef); \n\n\n # non-linear system transform\n s_pr ism := xinv_func(prism_add(sprime_prism, p_prism_L)); \n if ( PRINT_LEVEL1 = 1) then \n printsPrism(s_prism,\"(s_prism' \+ + Pl)^(-1) =\"); \n end;\n\n nlst_op1 := PermS(sprim e_prism,p_prism); \n #printsPrism(nlst_op1,\"out of PermS =\" ); \n\n nlst_op2 := xinv_func(prism_add(nlst_op1, p_prism_H)) ; \n if (PRINT_LEVEL1 = 1) then \n printsPrism(nl st_op2,\"(s_prism'_\{p_prism\} + Ph)^(-1) =\"); \n end;\n\n \+ #nlst_op3 := xinv_func(nlst_op2); \n #printsPrism(nls t_op3,\"out of xinv =\"); \n\n s_prism := prism_add(s_prism, \+ nlst_op2); \n #printsPrism(s_prism,\"s_prism befor e adding the previous hash h =\"); \n\n h := prism_add(s_pris m, h); \n #printsPrism(h,\"s_prism after nonlinear system tra nsform =\"); \n\n p_prism := Rubic_rot(p_prism); \n \+ #printPrism(p_prism,\"p_prism after Rubic transform= \"); \n \+ if (PRINT_LEVEL1 = 1) then \n printPrisms(h, p_prism,\"s_p rism after nonlinear system transform and p_prism after Rubic transfor m = \"); \n end;\n\n inter_ntrnc := Hash_gen(h,p_pri sm,512);\n inter := Hash_gen(h,p_prism,hash_len);\n\n \+ if (i <> num_chnk) then \n print(\"chunk's hash result b efore puncturing\");\n print(inter_ntrnc);\n p rint(convert(inter_ntrnc,hex));\n print(\"chunk's puncture d hash result\");\n print(inter);\n print(conv ert(inter,hex));\n else \n print(\"hash result before puncturing\");\n print(inter_ntrnc);\n \+ print(convert(inter_ntrnc,hex));\n print(\"shash result\" );\n print(inter);\n print(convert(inter,hex)) ;\n fi; \n od; \n\n hash := inter; #Hash_gen(h,p_prism,h ash_len);\n # Produce the final hash value (big-endian): \n # hash := (h0, h1, h2, h3, h4); \n #print(\"hash\", hash); \n \n r eturn hash; \nend;" }}{PARA 7 "" 1 "" {TEXT -1 74 "Warning, `inter_ntr nc` is implicitly declared local to procedure `s_hash`\n" }}{PARA 7 " " 1 "" {TEXT -1 68 "Warning, `inter` is implicitly declared local to p rocedure `s_hash`\n" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 1890 "# \+ shash parameters \n##################### \nprintlevel :=0;\nPRINT_LEVE L2 :=0 ;\nPRINT_LEVEL1 :=1 ;\nPRINT := 0; \nN := 4; \nNi := 8; \n\nMod ulus := 2^4+1; \ndefPoly := num2poly(2^5-1); \nFactor(%) mod 2; \n\n#s ubs(t=2,defPoly); \nunity := 4; # l'th the root of unity \nunity1 : = 2; # l'th the root of unity \nL_INV := 1;#N^(-1) mod Modulus; \nB ase := 2^4; \n\nfor i to 1 do\n F_matrix := setone(N); \n F_inv_ matrix := setone(N); \nod;\n\nfor i from 2 to N do \n for j to N do \+ \n F_matrix[i,j] := (unity)^((i-1)*(j-1)) mod Modulus; \n F_in v_matrix[N-i+2,j] := F_matrix[i,j]; \n od; \nod; \n#print(F_matri x); \n#print(F_inv_matrix); \n\nif (PRINT = 1) then\n printf(\"\\nF_ Matrix[4][4] = \{\"); \n for i from 1 to N do \n printf(\"\{\" ); \n for j to N do \n printf(\"%2d,\", F _matrix[i,j]); \n od; \n printf(\"\},\"); \n od; \n \+ printf(\"\}\\n\"); \n\n printf(\"\\nF_Inv_Matrix[4][4] = \{\"); \n \+ for i from 1 to N do \n printf(\"\{\"); \n for j to N do \n printf(\"%2d,\", F_inv_matrix[i,j]); \n \+ od; \n printf(\"\},\"); \n od; \n printf(\"\}\\n\"); \+ \nfi;\n\nfor i to 1 do\n Fi_matrix := setone(Ni); \n Fi_inv_matrix := setone(Ni); \nod;\nfor i from 2 to Ni do \n for j to Ni do \n \+ Fi_matrix[i,j] := (unity1)^((i-1)*(j-1)) mod Modulus; \n Fi_inv_m atrix[Ni-i+2,j] := Fi_matrix[i,j]; \n od; \nod; \n#print(Fi_matri x); \n#print(Fi_inv_matrix); \n\nif (PRINT = 1) then\n printf(\"\\nF i_Matrix[8][8] = \{\"); \n for i from 1 to Ni do \n printf(\" \{\"); \n for j to Ni do \n printf(\"%2d, \", Fi_matrix[i,j]); \n od; \n printf(\"\},\"); \n od ; \n printf(\"\}\\n\"); \n\n printf(\"\\nFi_Inv_Matrix[8][8] = \{ \"); \n for i from 1 to Ni do \n printf(\"\{\"); \n f or j to Ni do \n printf(\"%2d,\", Fi_inv_matrix[i, j]); \n od; \n printf(\"\},\"); \n od; \n printf(\" \}\\n\");\nfi;" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%+printlevelG\"\"! " }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%-PRINT_LEVEL2G\"\"!" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%-PRINT_LEVEL1G\"\"\"" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%&PRINTG\"\"!" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"N G\"\"%" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%#NiG\"\")" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%(ModulusG\"#<" }}{PARA 11 "" 1 "" {XPPMATH 20 "6 #>%(defPolyG,,\"\"\"F&%\"tGF&*$)F'\"\"#F&F&*$)F'\"\"$F&F&*$)F'\"\"%F&F &" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#,,\"\"\"F$%\"tGF$*$)F%\"\"#F$F$*$ )F%\"\"$F$F$*$)F%\"\"%F$F$" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%&unity G\"\"%" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%'unity1G\"\"#" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%&L_INVG\"\"\"" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%%BaseG\"#;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 1010 "pri ntlevel := -1;\nPRINT_LEVEL1 := 0;\nmLen := 512; # convert(%,binary);# must be provided \nhash_len := 128; #a multiple of 32 between 128 and 512 \n\n#################\n# shash-128 (122 bits or 95.31%):\nm1 := ` 0e5897f7454f3388baecdabc2e78c5c2a66eceedeb759ae591036e99c9e133c729380e 392fd723024511f64bf058806f5d97752918137de0d16156b9d14c26e0`;\nm2 := `0 e5897f74550cc48baecdabc2e78c5c2a66eceedeb759ae591036e99c9e133c729380e3 92fd723024511f64bf058806f5d97752918137de0d16156b9d14c26e0`;\n######### ########\n\nprint(\"########## message m1 ##########\");\nprint(m1);\n message := convert(m1,decimal,hex);\nprint(message);\nm1_hash := s_has h(message,mLen,hash_len); \n\nprintf(\"\\n\\n\");\n\nprint(\"######### # message m2 ##########\");\nprint(m2);\nmessage := convert(m2,decimal ,hex);\nprint(message);\nm2_hash := s_hash(message,mLen,hash_len); \n \nprintf(\"\\n\\n\");\n\nprint(\"final hash difference\");\nhash_diff \+ := subs(t=2,num2poly(m1_hash)+num2poly(m2_hash) mod 2);\nprint(hash_di ff);\nprint(convert(hash_diff,hex));\nprint(convert(hash_diff,binary)) ;\n\n" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#QA##########~message~m1~##### #####6\"" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#%[s0e5897f7454f3388baecdab c2e78c5c2a66eceedeb759ae591036e99c9e133c729380e392fd723024511f64bf0588 06f5d97752918137de0d16156b9d14c26e0G" }}{PARA 11 "" 1 "" {XPPMATH 20 " 6#\"dtS%*GpH0b'Q(Hb6=FyP8[\"[CVs\"[?'o&4y4vF$o(=ad\">N7thM>#yl#*)z\"o7 Sq[+*=FPZA&39G`hU(*)>T2fk8v" }}{PARA 6 "" 1 "" {TEXT -1 0 "" }}{PARA 11 "" 1 "" {XPPMATH 20 "6&Q-############6\"Q0chunk~number~=~F$\"\"\"F# " }}{PARA 11 "" 1 "" {XPPMATH 20 "6#QFchunk's~hash~result~before~punct uring6\"" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#\"eto$G,]?iPg?-oRsa<1qM^xV %**[#RfXBiyFg[)z.T.oKDh7m\\8]AVTO;KCc%[A$=.dpkchunk's~ punctured~hash~result6\"" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#\"H5+V4!4z TBfh(>*Q42wI(=\"" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#%A5952B675EEBF81D5 4CE60FA3BD19B5FAG" }}{PARA 6 "" 1 "" {TEXT -1 0 "" }}{PARA 11 "" 1 "" {XPPMATH 20 "6&Q-############6\"Q0chunk~number~=~F$\"\"#F#" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#Q>hash~result~before~puncturing6\"" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#\"ft*\\7Ol=i+S'4y)o5'QPipE(\\C?U*=OmYK*=E&Q' Hs#=%\\rsL:x,jAe*3/hd&G4&>3QA$\\UyOGCB/V(3hJD%[?w7" }}{PARA 11 "" 1 " " {XPPMATH 20 "6#%[sF3AB97E1F5157BF795806412D24D8699E2F022B8083F9E9312 FD775205766EF071A1265B1B98E8071B12FB17A3E11D6FD2F51AE5182CE2E4BC88A9BD E647B9D3G" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#Q-shash~result6\"" }} {PARA 11 "" 1 "" {XPPMATH 20 "6#\"Hr^(*=RbU(z%=/,\"\\uU8EeH" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#%ADE8E0A81261FB06EC9785DA73C82ACC3G" }} {PARA 6 "" 1 "" {TEXT -1 0 "" }}{PARA 6 "" 1 "" {TEXT -1 0 "" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#QA##########~message~m2~##########6\"" }} {PARA 11 "" 1 "" {XPPMATH 20 "6#%[s0e5897f74550cc48baecdabc2e78c5c2a66 eceedeb759ae591036e99c9e133c729380e392fd723024511f64bf058806f5d9775291 8137de0d16156b9d14c26e0G" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#\"dt!G$*o? r%p$*z%\\u4Ti')fr'fZ#Q%*pr;+Am%zL(=])pj>9'zDGS<\"=**)34$oW([)\\\\u9:&= =D!R1Jkl1.v7u!fk8v" }}{PARA 6 "" 1 "" {TEXT -1 0 "" }}{PARA 11 "" 1 " " {XPPMATH 20 "6&Q-############6\"Q0chunk~number~=~F$\"\"\"F#" }} {PARA 11 "" 1 "" {XPPMATH 20 "6#QFchunk's~hash~result~before~puncturin g6\"" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#\"etc(3(>x,qoA(R4#G+%e')*=L&H] %yQ:W.`%)*f?-l!>*fTll@cS#4rpqro0t3\"=R-Sq1q;K]O7kV*oWlvw#ft)f7" }} {PARA 11 "" 1 "" {XPPMATH 20 "6#%[s180E22438B29CCD9C81FDE151ED46363DA7 BC231EC5F028FB46826886D18C8DA4F6909045ABB940D1F5832378DEBA166662D3293D 57E9203E9CCEDC4B312AC54G" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#Q>chunk's~ punctured~hash~result6\"" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#\"Gw1N3rZS q-YUds4nY!yo)" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#%A415C1A68A6B19EE954F 564E1B171AED4G" }}{PARA 6 "" 1 "" {TEXT -1 0 "" }}{PARA 11 "" 1 "" {XPPMATH 20 "6&Q-############6\"Q0chunk~number~=~F$\"\"#F#" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#Q>hash~result~before~puncturing6\"" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#\"et27#4ucd#zxF[Q!e'QwSx!QXP4kz'Qj_NKmE%)3** [rJvpu@,:6UZAxrpKe;%p*\\xu#[jV'=T1)=E?i)=J,#oq#" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#%[s33AEA94437762D55E9F0F55F6275ABBEE5F0FA790437E54B89E4 913B006889F575AE820B1BA32AD22ECC7F5CACF15F75DA23474919D506AEBCF650C3EC 376777G" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#Q-shash~result6\"" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#\"H&\\S1'**\\+&\\Q%R+w0H(yspK" }}{PARA 11 " " 1 "" {XPPMATH 20 "6#%AF5FCAB0F6F557B27D1500C6F35E7B3EFG" }}{PARA 6 " " 1 "" {TEXT -1 0 "" }}{PARA 6 "" 1 "" {TEXT -1 0 "" }}{PARA 11 "" 1 " " {XPPMATH 20 "6#Q6final~hash~difference6\"" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#\"G)=a%oWj<\"\\`/WCl,C+_x&" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#%A2B72A18E494ACB49182851C809651F2CG" }}{PARA 11 "" 1 " " {XPPMATH 20 "6#\"ir+65+66,+,,5,,5+++5+6,+,,+55++5,+,5+,65+655+,,5+,5 6+5,+555+6,655" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 360 "# copy t he punctured hash values for m1 and m2 after the first chunk's process ing\nprint(\"intermediate hash difference, decimal, hex and binary\"); \nhash_diff := subs(t=2,num2poly(118730760709389197615923417909009430 010)+num2poly(86878046670972574246027040477108350676) mod 2); \nprint( hash_diff);\nprint(convert(hash_diff,hex));\nprint(convert(hash_diff,b inary));\n" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#QVintermediate~hash~diff erence,~decimal,~hex~and~binary6\"" }}{PARA 11 "" 1 "" {XPPMATH 20 "6# \"G'[&)eU')oT\")zq-gA\\\\lx>$" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#%A180 EAC1D480E1F3C18136B420C681B2EG" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#\"hr 565+65,++55,+6++5++,655,6+,++5,++66+66,+56+++5+,,6,++65556+++5\"" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 1009 "printlevel := -1;\nPRINT_L EVEL1 := 0;\nmLen := 512; # convert(%,binary);# must be provided \nhas h_len := 224; #a multiple of 32 between 128 and 512 \n\n############## ###\n# shash-224 (215 bits or 95.98%):\nm1 := `a2bbd509657c83d7520b5d4 0c8b236a4b7b330f7a1e95ee07b62b8da045690e28a412dd4acbf952cad4e645432c53 056f4e1cfebd22b48a9014a776bfde2ace1`;\nm2 := `9d442509657c83d7520b5d40 c8b236a4b7b330f7a1e95ee07b62b8da045690e28a412dd4acbf952cad4e645432c530 56f4e1cfebd22b48a9014a776bfde2ace1`;\n#################\n\nprint(\"### ####### message m1 ##########\");\nprint(m1);\nmessage := convert(m1,d ecimal,hex);\nprint(message);\nm1_hash := s_hash(message,mLen,hash_len ); \n\nprintf(\"\\n\\n\");\n\nprint(\"########## message m2 ########## \");\nprint(m2);\nmessage := convert(m2,decimal,hex);\nprint(message); \nm2_hash := s_hash(message,mLen,hash_len); \n\nprintf(\"\\n\\n\");\n \nprint(\"final hash difference\");\nhash_diff := subs(t=2,num2poly(m1 _hash)+num2poly(m2_hash) mod 2);\nprint(hash_diff);\nprint(convert(has h_diff,hex));\nprint(convert(hash_diff,binary));\n" }}{PARA 11 "" 1 " " {XPPMATH 20 "6#QA##########~message~m1~##########6\"" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#%[sa2bbd509657c83d7520b5d40c8b236a4b7b330f7a1e95ee 07b62b8da045690e28a412dd4acbf952cad4e645432c53056f4e1cfebd22b48a9014a7 76bfde2ace1G" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#\"et*o=R.VYoAjhUPe@X)Q HFm)euFIA/aZ[d!Hc'[Gl=2kg!>e')>b&)p,!fKwe_B=IOv]5)3fam$o')H$[Vgk0B&)" }}{PARA 6 "" 1 "" {TEXT -1 0 "" }}{PARA 11 "" 1 "" {XPPMATH 20 "6&Q-## ##########6\"Q0chunk~number~=~F$\"\"\"F#" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#QFchunk's~hash~result~before~puncturing6\"" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#\"etA\"[)fnYEB,2_[Vib:$pL1:uuvwW,$GO^#zd/4[_O&G7wtvjd<# Q@*4b8Ekd\"fs_]7gzrG(\\[py60t04oha" }}{PARA 11 "" 1 "" {XPPMATH 20 "6# %[s684823E2060971DB883CA756EE4995821D9E2322271D24FD93DB455ACDD04F677E7 550CE84F018BCD6A576030298160F643EB0243F9F2D5B5FF04AECC28A70BAG" }} {PARA 11 "" 1 "" {XPPMATH 20 "6#Q>chunk's~punctured~hash~result6\"" }} {PARA 11 "" 1 "" {XPPMATH 20 "6#\"_o'G#=<%3sAey-Ab$p@C@`>K:KW?fPMv.QUD s<" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#%YA8491D33167A4C99880AD0C8941BFE 4B2C5EC4230660C23DB714024EG" }}{PARA 6 "" 1 "" {TEXT -1 0 "" }}{PARA 11 "" 1 "" {XPPMATH 20 "6&Q-############6\"Q0chunk~number~=~F$\"\"#F# " }}{PARA 11 "" 1 "" {XPPMATH 20 "6#Q>hash~result~before~puncturing6\" " }}{PARA 11 "" 1 "" {XPPMATH 20 "6#\"ft'ol<\\kG\")3!)QVPs(y/-$*R[)z$p )33LZ6y>YHLUBfr1CHpX<\"" }} {PARA 11 "" 1 "" {XPPMATH 20 "6#%[sE043C0471E2C137C007098E68947E94101C CCDD4770191BAC64A01E40FACA3C6C5584CDFDDD98EBD78DBEB8BE9137DB03DB6C0789 EE448DA7E78ED9DAA6C3FB6G" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#Q-shash~re sult6\"" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#\"_o(>$[zOHA6#*)3?*[%[,l=Do $*=j#yZ[%oX*=L\\r8" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#%Y823B27E095A668 1AB1C43E884753E88FAFDE7EE1EC1C0FE47ED5693DG" }}{PARA 6 "" 1 "" {TEXT -1 0 "" }}{PARA 6 "" 1 "" {TEXT -1 0 "" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#QA##########~message~m2~##########6\"" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#%[s9d442509657c83d7520b5d40c8b236a4b7b330f7a1e95ee07b62 b8da045690e28a412dd4acbf952cad4e645432c53056f4e1cfebd22b48a9014a776bfd e2ace1G" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#\"etpFl#pp9gaib>0T5\\@)[([u -9'z*3p>gAip$\\+hx\">4U.6'zZ-c,3J&oo&*>vy.+f8j&psb+TyX/JUl:()pO#)" }} {PARA 6 "" 1 "" {TEXT -1 0 "" }}{PARA 11 "" 1 "" {XPPMATH 20 "6&Q-#### ########6\"Q0chunk~number~=~F$\"\"\"F#" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#QFchunk's~hash~result~before~puncturing6\"" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#\"et'*)>3^:\"eC8tQ,]@\"*Q$H(3?MKZC#R!H'ySX#>)R+z2v*[vKh'=rwki1XB8)3_G/HrU]" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#%[s604844698664C65F88361651AFD840678D9ED67A271DA7A493DC6FE2C7D08 30576976E7E8DCF5681B887B38B0792447311EE103EAB9F94F98FF5B61FC2C7DC38G" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#Q>chunk's~punctured~hash~result6\"" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#\"_o')e,>F3GZgsUuSK[2@xS*eY#eUiX3Xe; 6fN9" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#%Y88514973863E23D9EE0F80EEF832 F17E5E6A3F272587836EFF6B83CEG" }}{PARA 6 "" 1 "" {TEXT -1 0 "" }} {PARA 11 "" 1 "" {XPPMATH 20 "6&Q-############6\"Q0chunk~number~=~F$\" \"#F#" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#Q>hash~result~before~puncturi ng6\"" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#\"ft\"))4H095xwbq:Su#[i#*Qrhs :5$fgCj9tf2_AQ!4=lQQ%[N%fy6yp!*>#**o#4\"Q.qL(3\\2.\"H2c?5W1rAE;Y;7" }} {PARA 11 "" 1 "" {XPPMATH 20 "6#%[sE84367DC7E40A4F8017A29E1C6D63CA491C B388C770112E3C64D2B5C45AC6FA46DBA626FD4E6C08016F92302EC1921BC489660620 AE4F178AE0D116EAF219339G" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#Q-shash~re sult6\"" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#\"_o5dB:MkD_K*4x%fBB]w%zXqi iW()=\\)=#=2+F/#" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#%YC1F749C14A040AB2 CB88412A069D1DCF5A06D270AE4509ECF668EC7EG" }}{PARA 6 "" 1 "" {TEXT -1 0 "" }}{PARA 6 "" 1 "" {TEXT -1 0 "" }}{PARA 11 "" 1 "" {XPPMATH 20 "6 #Q6final~hash~difference6\"" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#\"^oz<$ Hme.g[^'oYp,#\\(GCu_&**\\XJHO%H+D@+9(" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#%Y43CC6E21DFA262A87A4C7FA241CEF540F5D8AC914259060888BD8543G" }} {PARA 12 "" 1 "" {XPPMATH 20 "6#\"jx6++,,,+5,665+5+5+5++5,++,5,,5++,,+ ,5+655+5,6,,66+++,,,6656+6,++,5+55666,+6+,556,+5555+5,5+5566,6,+5+565, +6+66++\"" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 419 "# copy the pu nctured hash values for m1 and m2 after the first chunk's processing\n print(\"intermediate hash difference, decimal, hex and binary\"); \nha sh_diff := subs(t=2,num2poly(17722542380375343759204432153219532124216 935522027858227208417182286)+num2poly(14355911165845084562425824658940 772107483240744272604728082719015886) mod 2); \nprint(hash_diff);\npri nt(convert(hash_diff,hex));\nprint(convert(hash_diff,binary));\n" }} {PARA 11 "" 1 "" {XPPMATH 20 "6#QVintermediate~hash~difference,~decima l,~hex~and~binary6\"" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#\"^o/B[mh\")4z '*yHWtp8J7C2rzv(po[5a!)[<+!Q$" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#%Y201 8544090446F40660550266C290F357234FB0423E74153487F8180G" }}{PARA 12 "" 1 "" {XPPMATH 20 "6#\"ix+++5,++5666,+5+,6+,,,++,6,566+5++,++6566+,6+5+ 6,,,6+66++,55++65,5,5+++,,,,++5,5,+++,665,+,+,++,5+++,+,,,+5,+++5" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 1008 "printlevel := -1;\nPRINT_L EVEL1 := 0;\nmLen := 512; # convert(%,binary);# must be provided \nhas h_len := 512; #a multiple of 32 between 128 and 512 \n\n############## ###\n# shash-512 (482 bits or 94.14%)\nm1 := `ba585480aabf5af1f919bf1a b2f086d86d2bfcf627e988e3dd02c5606fb2700de898909c26153076474d9f1cc97314 1fe518a2e95c3b5713f9af2ce8ef99d309`;\nm2 := `ba585480aabf5af1f919bf1ab 2f086d86d2bfcf627e988e3dd02c5606fb58ff3e898909c26153076474d9f1cc973141 fe518a2e95c3b5713f9af2ce8ef99d309`;\n#################\n\nprint(\"#### ###### message m1 ##########\");\nprint(m1);\nmessage := convert(m1,de cimal,hex);\nprint(message);\nm1_hash := s_hash(message,mLen,hash_len) ; \n\nprintf(\"\\n\\n\");\n\nprint(\"########## message m2 ########## \");\nprint(m2);\nmessage := convert(m2,decimal,hex);\nprint(message); \nm2_hash := s_hash(message,mLen,hash_len); \n\nprintf(\"\\n\\n\");\n \nprint(\"final hash difference\");\nhash_diff := subs(t=2,num2poly(m1 _hash)+num2poly(m2_hash) mod 2);\nprint(hash_diff);\nprint(convert(has h_diff,hex));\nprint(convert(hash_diff,binary));\n" }}{PARA 11 "" 1 " " {XPPMATH 20 "6#QA##########~message~m1~##########6\"" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#%[sba585480aabf5af1f919bf1ab2f086d86d2bfcf627e988e 3dd02c5606fb2700de898909c26153076474d9f1cc973141fe518a2e95c3b5713f9af2 ce8ef99d309G" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#\"etXRy$)yhG>RLVV&QXWq :?\\#y_\")e)4$\\$*p***))*z5#zURN\"*pW^x#\\EbuX,gOD/pHlfPBwxnlkWDNgQ\"* =H;of(*" }}{PARA 6 "" 1 "" {TEXT -1 0 "" }}{PARA 11 "" 1 "" {XPPMATH 20 "6&Q-############6\"Q0chunk~number~=~F$\"\"\"F#" }}{PARA 11 "" 1 " " {XPPMATH 20 "6#QFchunk's~hash~result~before~puncturing6\"" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#\"ftq.dpg1%Rnb'[qteWPV?[?au$)f]:5o]Mzt,0g$f_ n:I+<;NeuPdSn>g0wJRO[%R3iq\"G%))oM$G.qyNI8+6" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#%[sD20D61F5714E32F2791D51D4624CCEDA490CE20FE1743385184B F3BAD52ABB2847C1C5EC3C7B7288D7B50D6EC169158C41AF267A1166F338398E4AA1FD A1C342G" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#Q>chunk's~punctured~hash~re sult6\"" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#\"ftq.dpg1%Rnb'[qteWPV?[?au $)f]:5o]Mzt,0g$f_n:I+<;NeuPdSn>g0wJRO[%R3iq\"G%))oM$G.qyNI8+6" }} {PARA 11 "" 1 "" {XPPMATH 20 "6#%[sD20D61F5714E32F2791D51D4624CCEDA490 CE20FE1743385184BF3BAD52ABB2847C1C5EC3C7B7288D7B50D6EC169158C41AF267A1 166F338398E4AA1FDA1C342G" }}{PARA 6 "" 1 "" {TEXT -1 0 "" }}{PARA 11 " " 1 "" {XPPMATH 20 "6&Q-############6\"Q0chunk~number~=~F$\"\"#F#" }} {PARA 11 "" 1 "" {XPPMATH 20 "6#Q>hash~result~before~puncturing6\"" }} {PARA 11 "" 1 "" {XPPMATH 20 "6#\"etqJy\"*G6(e>XB%yUp#H\"Rq$4XCf,6q%y$ >#>>4rfha6bKgppzT!y'R;-,6$QEzE&RV#f7tLxSrA\"yoB#pf#fEw#*" }}{PARA 11 " " 1 "" {XPPMATH 20 "6#%[sB11D717F7D2C73C1859F120D18A429BC772B94E727636 62F54FCFB01F2AADC581042CE1BFF80BEDF2F9AB1D7E66934E02A6CB78B9A7F05E9B2D 526EA57311802G" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#Q-shash~result6\"" } }{PARA 11 "" 1 "" {XPPMATH 20 "6#\"etqJy\"*G6(e>XB%yUp#H\"Rq$4XCf,6q%y $>#>>4rfha6bKgppzT!y'R;-,6$QEzE&RV#f7tLxSrA\"yoB#pf#fEw#*" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#%[sB11D717F7D2C73C1859F120D18A429BC772B94E72763 662F54FCFB01F2AADC581042CE1BFF80BEDF2F9AB1D7E66934E02A6CB78B9A7F05E9B2 D526EA57311802G" }}{PARA 6 "" 1 "" {TEXT -1 0 "" }}{PARA 6 "" 1 "" {TEXT -1 0 "" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#QA##########~message~m 2~##########6\"" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#%[sba585480aabf5af1 f919bf1ab2f086d86d2bfcf627e988e3dd02c5606fb58ff3e898909c26153076474d9f 1cc973141fe518a2e95c3b5713f9af2ce8ef99d309G" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#\"et4%Q?xE=LG5k@8+1`eP>L!H)*3Bc@mx=Kc:S(RhdnW.To^x#\\Eb uX,gOD/pHlfPBwxnlkWDNgQ\"*=H;of(*" }}{PARA 6 "" 1 "" {TEXT -1 0 "" }} {PARA 11 "" 1 "" {XPPMATH 20 "6&Q-############6\"Q0chunk~number~=~F$\" \"\"F#" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#QFchunk's~hash~result~before ~puncturing6\"" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#\"et(>b(yvS:Eh @PaBK=e0WksD+G-,\\I=Pj];jO#*))))*p\">IBP!*H'>R'4m&[0D()*)[A$=mY\"y_0rC z3u[)" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#%[sA20D970A734A6E3D7B1D302662 2C0001031FCB18CE84EC58834626722BF2812B15C33A0BA47BF605D7A2586AC16F6A16 E9984935116E17C20985A468F3BA707DG" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#Q >chunk's~punctured~hash~result6\"" }}{PARA 11 "" 1 "" {XPPMATH 20 "6# \"et(>b(yvS:Eh@PaBK=e0WksD+G-,\\I=Pj];jO#*))))*p\">IBP!*H'>R'4m& [0D()*)[A$=mY\"y_0rCz3u[)" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#%[sA20D97 0A734A6E3D7B1D3026622C0001031FCB18CE84EC58834626722BF2812B15C33A0BA47B F605D7A2586AC16F6A16E9984935116E17C20985A468F3BA707DG" }}{PARA 6 "" 1 "" {TEXT -1 0 "" }}{PARA 11 "" 1 "" {XPPMATH 20 "6&Q-############6\"Q0 chunk~number~=~F$\"\"#F#" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#Q>hash~res ult~before~puncturing6\"" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#\"et_WF=2F iBOcJ:\\O-q**)G+n!*p$4g@\\EIXoMu:?M-mfiaN'po!eQD^AS)\\V[M+\"=fmE$\\k$[ ti.k'o%G\\m7R%)" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#%[sA12197806C382F0E 574173FA1415E7673D70BF300E4BB9F2FBA22E293F8EE65B448A310C6A083A521F6DE4 D3E6704B7A0813D9C49070E01785A5C82349BAAB94G" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#Q-shash~result6\"" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#\" et_WF=2FiBOcJ:\\O-q**)G+n!*p$4g@\\EIXoMu:?M-mfiaN'po!eQD^AS)\\V[M+\"=f mE$\\k$[ti.k'o%G\\m7R%)" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#%[sA1219780 6C382F0E574173FA1415E7673D70BF300E4BB9F2FBA22E293F8EE65B448A310C6A083A 521F6DE4D3E6704B7A0813D9C49070E01785A5C82349BAAB94G" }}{PARA 6 "" 1 " " {TEXT -1 0 "" }}{PARA 6 "" 1 "" {TEXT -1 0 "" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#Q6final~hash~difference6\"" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#\"dtEr?'Q^pRb?C/Hxcx(z8F!H37*))G([pkt#4HOv-!ed_%G$yjp%Q _gQnrrJHspz>2'ev$Rlw1h=KN>)4_\"yW])" }}{PARA 11 "" 1 "" {XPPMATH 20 "6 #%[s103CE6FF11145CCFD2DE61F70CB1CEDB4A5B2BD72928DFDDAF5ED528CD243A0354 C8FF179588848D30F7550400197F9A227F6E4F0A0FE5FE3770EEC91E8BB396G" }} {PARA 12 "" 1 "" {XPPMATH 20 "6#\"hjl5,,56+6565+556,+,5+65656++6,6,6+5 666,,5666++55++66+,565,666,5+5+55,5666,,5,++++++,++,,,,6,66++6+,6+5+,+ 5+5+5,,,56,,+6666+5+6+,,,6+++556++,5+,6+6+55+,,,656,,6655,6,666,6+55+, 55+6,,6655+65,,55+,65,656+6,+65+6++6,66,+5,56,65+,666+6+6,,+,,+,+,+666 65,56+66+++\"" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 591 "# copy th e punctured hash values for m1 and m2 after the first chunk's processi ng\nprint(\"intermediate hash difference, decimal, hex and binary\"); \+ \nhash_diff := subs(t=2,num2poly(1100133035787003283346888428170620839 4483639317605601967405737745835161700301567525936005017379345068101550 598374542048204337445873704865567394066069570370)+num2poly(84874087924 7105527814666183224889872505485660963919629903723301916998888923663165 0633718304901022800257264440558183223543721612619486225541715407578755 197) mod 2); \nprint(hash_diff);\nprint(convert(hash_diff,hex));\nprin t(convert(hash_diff,binary));" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#QVint ermediate~hash~difference,~decimal,~hex~and~binary6\"" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#\"etzW'z%e1Gz/5$f`?i88\">2(R'f]J?]jv(R'*=#)R_2CR\\ $o**z[1\"[![zpFaW!>1.i@(e7Y!4N2P_\\Fx1d1O8h'e" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#%[s7000F6FF02045CCF020061F20060CEDB4A1329172FF0DFDD9B0D D5C8FED83A035202FFE79800848D0017550400067F9AA8376F4F0008E4FA300BEEC90E 1BB33FG" }}{PARA 12 "" 1 "" {XPPMATH 20 "6#\"jjl666+6+6565,+56++,5+656 5665++++6+5566+,56+5++++++66+,665,6,6++55555,5666,5,+++++++,++,,,,6,,+ ++++,6+5+,+5+++++5,56,5666665+++5+,,6+++556++5,65666+5+6,,,6,6++65,5,6 ,666,6++66665+6,,+,55+6+,+55+,65,656+6++5,++++5+66,+5,++++5+++66+6+6,, +,++5+++66665,66++++++6\"" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{MARK "31 0 0" 642 }{VIEWOPTS 1 1 0 3 4 1802 1 1 1 1 } {PAGENUMBERS 0 1 2 33 1 1 }