T-C-T函数

T-C-T函数论文下载
论文名称:Highly Nonlinear Boolean Functions With Optimal Algebraic Immunity and Good Behavio Against Fast Algebraic Attacks
1.Combinatorial Fact
这里写图片描述
2.Construction1
这里写图片描述
3. Construction1 optimal algebraic immunity n/2
4.Construction1 algebraic degree n-2
5.Construction1 nonlinearity

//此为magma代码
//计算Tang_Carlet_Tang函数construction1非线性度
function non(k)
for ss:=0 to 2^k-2 by 1 do 
G<x>:=GF(2,k);
Z:=IntegerRing();
g:=[];
for tt:=0 to 2^k-2 by 1 do //初始化g的真值表全为0
bin1:=Eltseq(x^tt, GF(2)); toInt1 := [Z | bin1 [j] : j in {1.. k by 1}];
k1:=&+[toInt1[i]*(2^(i-1)): i in [1..k]]; g[k1]:=0;
end for;
n:=2*k;
F<w>:=GF(2,n);
f:=[];
for tt:=0 to 2^n-2 by 1 do //初始化f的真值表全为0
bin3:=Eltseq(w^tt, GF(2)); toInt3 := [Z | bin3 [j] : j in {1.. n by 1}];
k3:=&+[toInt3[i]*(2^(i-1)): i in [1..n]]; f[k3]:=0;
end for;
for tt:=0+ss to 2^(k-1)+ss-1 by 1 do //根据g的支撑架生成g的真值表
bin2:=Eltseq(x^tt, GF(2)); toInt2 := [Z | bin2 [j] : j in {1.. k by 1}];
k2:=&+[toInt2[i]*(2^(i-1)): i in [1..k]]; g[k2]:=1;
end for;
//g:=[0] cat g;//记住教训
for tt:=0 to 2^k-2 by 1 do //由f(x,y)=g(xy)生成f的真值表
    for dd:=0 to 2^k-2 by 1 do 
    bin4:=Eltseq(x^tt, GF(2)); toInt4 := [Z | bin4 [j] : j in {1.. k by 1}];
    bin5:=Eltseq(x^dd, GF(2)); toInt5 := [Z | bin5 [j] : j in {1.. k by 1}];
    bin6:=Eltseq(x^(tt+dd), GF(2)); toInt6 := [Z | bin6 [j] : j in {1.. k by 1}];
    toIntw:=toInt4 cat toInt5;
    k4:=&+[toIntw[i]*(2^(i-1)): i in [1..n]]; 
    k5:=&+[toInt6[i]*(2^(i-1)): i in [1..k]];
    value:=g[k5];
    f[k4]:=value;
    end for;
end for;
f:=[0] cat f;
a:= [1-2*f[i]:i in [1..2^n]];
for tt:=1 to n by 1 do // butterfly algorithm
    t:=2^n div 2^tt;
for j:=0 to 2^tt-1 by 2 do
for l:=1 to t by 1 do
        a[t*j+l]:=a[t*j+l]+a[t*(j+1)+l];
        a[t*(j+1)+l]:=a[t*j+l]-2*a[t*(j+1)+l];
end for;
    end for;
end for;
b:=[Abs (a[i]):i in [1..2^n]];
nl:=2^(n-1)-Max(b) div 2;
nl;
end for; 
end function;
单变元表示sagemath代码
from sage.crypto.boolean_function import BooleanFunction
k=7
n=2*k
F.<v>=GF(2^n)
f=[0]*(2^n)
suppfg=[x for x in range(2^(k-1))]
for i in range(2^k):
    for j in range(2^k):
        modij=(i+j) % (2^k-1)
        if modij in  suppfg:
            k1=(v^((2^k+1)*i)+(v^(2^k-1)*v^((2^k+1)*j))).integer_representation()
            f[k1]=1

B=BooleanFunction(f)
B.nonlinearity()

程序计算结果(选取最大值)
这里写图片描述
6. construction1 Immunity against fast algebraic attacks(取s=0)
n=4: (1,1)
n=6: (1,3),(2,3)
n=8: (1,5),(2,3),(3,3)
n=10: (1,7),(2,7),(3,6)
n=12: (1,9),(2,7),(3,7),(4,6)
7. Construction2
这里写图片描述
这里写图片描述
8. Construction1 optimal algebraic immunity n/2
9.Construction1 algebraic degree n-1
10.Construction2 nonlinearity

//此为magma代码
//计算Tang_Carlet_Tang函数construction2非线性度
k:=8;
for ss:=0 to 2^k-2 by 1 do 
//ss:=0;
G<x>:=GF(2,k);
Z:=IntegerRing();
g:=[];
for tt:=0 to 2^k-2 by 1 do //初始化g的真值表全为0
bin1:=Eltseq(x^tt, GF(2)); toInt1 := [Z | bin1 [j] : j in {1.. k by 1}];
k1:=&+[toInt1[i]*(2^(i-1)): i in [1..k]]; g[k1]:=0;
end for;
n:=2*k;
F<w>:=GF(2,n);
f:=[];
for tt:=0 to 2^n-2 by 1 do //初始化f的真值表全为0
bin3:=Eltseq(w^tt, GF(2)); toInt3 := [Z | bin3 [j] : j in {1.. n by 1}];
k3:=&+[toInt3[i]*(2^(i-1)): i in [1..n]]; f[k3]:=0;
end for;
for tt:=0+ss to 2^(k-1)+ss-1 by 1 do //根据g的支撑架生成g的真值表
bin2:=Eltseq(x^tt, GF(2)); toInt2 := [Z | bin2 [j] : j in {1.. k by 1}];
k2:=&+[toInt2[i]*(2^(i-1)): i in [1..k]]; g[k2]:=1;
end for;
//g:=[0] cat g;
for tt:=0 to 2^k-2 by 1 do //由f(x,y)=g(xy)生成f的真值表
    for dd:=0 to 2^k-2 by 1 do 
    bin4:=Eltseq(x^tt, GF(2)); toInt4 := [Z | bin4 [j] : j in {1.. k by 1}];
    bin5:=Eltseq(x^dd, GF(2)); toInt5 := [Z | bin5 [j] : j in {1.. k by 1}];
    bin6:=Eltseq(x^(tt+dd), GF(2)); toInt6 := [Z | bin6 [j] : j in {1.. k by 1}];
    toIntw:=toInt4 cat toInt5;
    k4:=&+[toIntw[i]*(2^(i-1)): i in [1..n]]; 
    k5:=&+[toInt6[i]*(2^(i-1)): i in [1..k]];
    value:=g[k5];
    f[k4]:=value;
    end for;
end for;
//设定u(x)真值表
u2:=[0,1,1,0];
u3:=[1,1,1,0,0,1,0,0];
u4:=[0,1,1,0,0,1,0,1,0,0,1,1,0,1,1,0];
u5:=[0,0,1,0,0,1,0,1,1,1,1,1,1,0,1,1,0,1,1,1,0,0,0,0,0,1,0,1,0,1,0,0];
u6:=[0,1,0,1,0,1,1,0,0,1,1,1,0,1,0,0,1,1,0,0,0,1,1,0,1,0,1,1,0,0,0,1,\
    0,1,1,1,0,0,0,1,1,0,1,0,0,0,1,1,1,0,0,0,0,1,1,1,1,1,1,0,0,1,0,0];
u7:=[1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,\
    0,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,0,1,\
    1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,1,0,\
    1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,1,0,1,0,0,0,1,0,0,1,0,1,1,1];
u8:=[0,1,0,1,1,1,0,0,1,0,0,0,0,1,1,1,0,1,1,1,1,1,0,0,1,0,0,0,0,1,1,0,0,\
    1,0,0,1,1,0,0,1,0,1,0,0,1,1,1,1,1,1,1,0,0,1,1,0,1,0,1,0,0,0,0,0,1,\
    1,1,0,1,1,1,0,1,0,1,0,0,0,0,0,1,1,1,0,1,1,0,0,0,0,1,0,1,1,0,1,0,0,0,\
    1,1,0,0,1,0,1,0,0,1,1,1,1,0,0,0,1,0,1,1,0,1,1,1,0,0,0,1,0,1,1,1,0,1,0,\
    0,1,0,0,1,0,1,1,0,1,0,1,1,0,0,1,1,0,1,1,1,0,0,0,0,0,1,1,1,0,1,1,0,0,1,\
    0,1,0,1,0,0,1,0,0,0,1,0,1,1,1,1,1,0,0,0,0,1,1,0,1,0,0,0,1,1,0,1,1,1,0,\
    0,0,1,1,0,0,0,1,0,0,1,1,1,1,0,0,0,1,1,1,0,0,0,1,0,0,1,1,0,1,0,0,1,1,1,\
    0,1,1,0,0,1,0,1,0,0,1,1,0,1,1,0];
for dd:=0 to 2^k-2 by 1 do //当x=0,根据不同k值,选取不同u(x)的真值表
    bin7:=Eltseq(x^dd, GF(2)); toInt7 := [Z | bin7 [j] : j in {1.. k by 1}];
    k7:=&+[toInt7[i]*(2^(i-1)): i in [1..k]]; f[k7]:=u8[k7+1];//此处有u
end for;
f:=[u8[1]] cat f;//此处有u
a:= [1-2*f[i]:i in [1..2^n]];
for tt:=1 to n by 1 do // butterfly algorithm
    t:=2^n div 2^tt;
for j:=0 to 2^tt-1 by 2 do
for l:=1 to t by 1 do
        a[t*j+l]:=a[t*j+l]+a[t*(j+1)+l];
        a[t*(j+1)+l]:=a[t*j+l]-2*a[t*(j+1)+l];
end for;
    end for;
end for;
b:=[Abs (a[i]):i in [1..2^n]];
nl:=2^(n-1)-Max(b) div 2;
nl;
//Write("input.txt",f);
end for;
#此为sagemath代码
#/usr/bin/env sage
import gc
from sage.crypto.boolean_function import BooleanFunction
k=13
n=2*k
u=[0]*(2^n)
F.<w>=GF(2^n)
for tt in range(0,2^n-1):
    fv=0
    k1=(w^tt).integer_representation()
    a=str('{0:b}'.format(k1))
    #变成二进制数,不带‘0b’格式
    b=list(a.rjust(n,'0'))
    #补足n位,以进行点积运算
    b=[int(x) for x in b]
    #转换为int型
    for i in range(0,k):
        fv=fv+b[i]*b[i+k]
        #进行点积运算
    fv=fv%2
    u[k1]=fv
#del b
#gc.collect()
B=BooleanFunction(u)
#B.nonlinearity()
from brial import *
k=7
m=1
s=k/2
#构造第一部分
ring1 = BooleanPolynomialRing(k,'x')
x=[]
for i in range(0,k):
    x.append(ring1.gen(i))
p1=(x[0]*x[1]+0)
for  t in range(4,k+1):
    p1=p1+(x[t-2]*x[t-1]+0)
B1=BooleanFunction(p1)
f1=list(B1.truth_table(format='int'))
#del p1, x,ring1
#gc.collect()
#构造第二部分
ring2 = declare_ring([Block('y',k-2*m),Block('x',k)],globals())
x=[]
for i in range(k-2*m,2*k-2*m):
    x.append(ring2.gen(i))
y=[]
for i in range(0,k-2*m):
    y.append(ring2.gen(i))
p2=x[0]*x[1]
for  i in range(0,k-2*m):
    p2=p2+y[i]*x[i+2*m]
B2=BooleanFunction(p2)
#B2.nonlinearity()
f2=list(B2.truth_table(format='int'))
F=f1+f2[2^k:]
B=BooleanFunction(F)
fx=B.algebraic_normal_form()
#del ring2,x,y,p2,B2,f2,F
#gc.collect()
n=2*k-2*m+1
ring3 = BooleanPolynomialRing(n,'x')
x=[]
for i in range(0,n):
    x.append(ring3.gen(i))
fx1=1
for i in range(0,n-1):
    fx1=fx1*(1+x[i])
fx2=x[n-1]
for i in range(k,n-1):
    fx2=fx2*(1+x[i])
fx=fx+fx1+fx2
B=BooleanFunction(fx)
v=list(B.truth_table(format='int'))
F=v+u[2^n:]
B1=BooleanFunction(F)
#B.nonlinearity()
U=F
#del ring3,x,fx1,fx2,fx,B,v,F
#gc.collect()

#x*y(2^(k-1)+1)
k=13
n=2*k
g.<w>=GF(2^k)
g=[0]*(2^k)
for tt in range(0,2^(k-1)):
    g[(w^tt).integer_representation()]=1

f.<v>=GF(2^n)
f=[0]*(2^n)
#x!=0,y!=0
for tt in range(0,2^k-1):
    for dd in range(0,2^k-1):
        k1=((w^tt)*(w^(dd*(2^k-2)))).integer_representation()
       # k1=(w^(tt+dd)).integer_representation()
        k2=((w^tt).integer_representation())*(2^k)+(w^dd).integer_representation()
        f[k2]=g[k1]
#x=0
for tt in range(0,2^k-1):
    k3=(w^tt).integer_representation()
    f[k3]=U[k3]
#f[0]=U[0]

B2=BooleanFunction(f)
#del g,f
#gc.collect()
B2.nonlinearity()

程序计算结果
这里写图片描述
11 .construction2 Immunity against fast algebraic attacks(取s=0)
n=4: (1,1)
n=6: (1,3)
n=8: (1,5),(2,4),(3,3)
n=10: (1,7),(2,6),(3,5),(4,4)
n=12: (1,9),(2,8),(3,7),(4,6),(5,5)
n=14: (1,11),(2,11),(3,10),(4,8)

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: T-S模糊建模是指根据Takagi-Sugeno模糊推理系统的原理,使用模糊逻辑方法建立的一种模糊模型。Matlab是一个强大的科学计算软件,可以用来实现T-S模糊建模。 T-S模糊建模的主要目的是对于给定的输入变量,建立一种模糊规则系统,通过模糊推理来进行预测或控制。这种模糊模型是由一系列模糊规则和输出函数组成的。 在Matlab,我们可以使用fuzzy工具箱来实现T-S模糊建模。首先,需要定义输入变量和输出变量的模糊集合,在每个模糊集合,可以设置若干个模糊集合函数,如三角形、梯形等。 然后,需要定义模糊规则,即输入变量与输出变量之间的关系。这些规则可以基于专家知识或者通过数据训练得到。在Matlab,可以使用fuzzy工具箱提供的函数来定义和管理这些规则。 最后,需要定义输出函数,将模糊规则的结果映射到具体的输出值上。在Matlab,可以通过设置模糊集合的隶属度函数来实现这一点。 通过以上步骤,我们就可以将T-S模糊建模应用到具体的问题。根据输入数据,通过模糊推理系统,可以得到模糊的输出结果。如果需要,还可以通过去模糊化方法,将模糊的输出结果转化为具体的数值。 总之,T-S模糊建模是一种基于模糊逻辑的建模方法,通过Matlab的fuzzy工具箱,我们可以方便地实现该方法,用于数据分析、预测和控制等领域。 ### 回答2: T-S模糊建模是一种常见的模糊控制方法,它在控制系统应用广泛。T-S模糊建模基于“如果-那么”规则,通过将系统模型分解成一系列子模型,每个子模型通过模糊规则进行建模,从而实现对系统的有效控制。 在Matlab,可以使用Fuzzy Logic Toolbox实现T-S模糊建模。首先,需要定义输入变量和输出变量的模糊集合及其隶属函数。输入隶属函数用于描述输入变量的模糊集合,例如“低”、“”、“高”;输出隶属函数用于描述输出变量的模糊集合,例如“小”、“适”、“大”。 然后,需要定义模糊规则。模糊规则是一种条件与结论之间的映射关系,用于描述输入变量与输出变量之间的关系。可以根据实际问题来确定模糊规则,例如:“如果输入变量A是低,并且输入变量B是,则输出变量C是小”。 接下来,需要设计模糊推理机制。模糊推理将模糊规则与模糊集合进行组合,从而得到输出的模糊集合。常见的模糊推理方法包括最小最大法和加权平均法。最小最大法取各个规则输出的模糊集合的最小值,加权平均法则根据规则的权重对模糊集合进行加权平均。 最后,通过去模糊化处理将输出的模糊集合转化为具体的数值,以得到系统的控制输出。可以使用常见的去模糊化方法,如最大值法、心加权平均法等。 总之,T-S模糊建模是一种通过将系统模型分解为多个子模型,通过模糊规则对子模型进行建模的方法。在Matlab,可以利用Fuzzy Logic Toolbox来实现T-S模糊建模,并通过定义模糊集合、模糊规则、模糊推理和去模糊化等步骤来完成建模过程。这种方法在控制系统、模式识别等领域有着广泛的应用。 ### 回答3: T-S模糊建模是一种将模糊集理论应用于系统建模的方法,它结合了模糊集合和模糊逻辑控制的思想。在T-S模糊建模,系统被分解为一系列局部模型,并利用隶属度函数描述系统的模糊性。 在Matlab,我们可以使用模糊逻辑工具箱来实现T-S模糊建模。首先,我们需要明确系统的输入和输出变量,并确定它们的隶属度函数。然后,根据输入变量和输出变量之间的关系,建立一系列模糊规则。 在T-S模糊建模,每个模糊子系统表示为一个模糊规则,规则由两个部分组成:前提部分和结论部分。前提部分是对输入变量的模糊描述,而结论部分是对输出变量的模糊描述。根据这些规则,我们可以用Matlab代码定义模糊推理过程。 模糊控制器的设计是T-S模糊建模的一个重要应用。在Matlab,我们可以使用模糊控制器工具箱来设计模糊控制器。首先,我们需要确定输入和输出变量的隶属度函数,并定义一系列模糊规则。然后,我们可以使用模糊推理和去模糊方法来生成控制信号。 总之,T-S模糊建模是一种将模糊集合理论应用于系统建模的方法,在Matlab可以使用模糊逻辑工具箱来实现。通过确定系统的输入和输出变量的隶属度函数,并建立模糊规则,我们可以进行模糊推理和控制。这种方法在各种实际应用都具有广泛的应用前景。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值