>From the doc of .algebraic_immunity : Returns the algebraic immunity of the Boolean function. This is the smallest integer i such that there exists a non trivial annihilator for self or ~self.
The annihilator you get is for ~f1 (or if you prefer 1+f1) You can check that: (1+f1)*annihilator_f1 == 0 Best regards Le mardi 20 août 2013 20:01:03 UTC+2, Martin Albrecht a écrit : > > Hi Yann, > > I believe you are the original author of this code? > > Cheers, > Martin > > ---------- Forwarded Message ---------- > > Subject: [sage-support] Re: Possible bug in algebraic_immunity( ) function > in > crypto toolbox > Date: Tuesday 20 August 2013, 08:54:18 > From: Oleksandr Kazymyrov <vrona.ak...@gmail.com <javascript:>> > To: sage-s...@googlegroups.com <javascript:> > > I have the same problem. > > My output (Mac OS 10.8.4 with sage 5.11) for > #!/usr/bin/env sage > > from sage.crypto.boolean_function import BooleanFunction > > P = BooleanPolynomialRing(4,'x') > P.inject_variables() > f = BooleanFunction(x0*x2 + x2*x3 + 1) > > print "f.algebraic_immunity() = {0}".format(f.algebraic_immunity()) > print "f.annihilator(f.algebraic_immunity()) = > {0}".format(f.annihilator(f.algebraic_immunity())) > print "f.algebraic_immunity(annihilator=True) = > {0}".format(f.algebraic_immunity(annihilator=True)) > > g = BooleanFunction(f.algebraic_immunity(annihilator=True)[1]) > > print "f = {0}".format(f.algebraic_normal_form()) > print "g = {0}".format(g.algebraic_normal_form()) > print "g*f = > {0}".format(g.algebraic_normal_form()*f.algebraic_normal_form()) > > is > Defining x0, x1, x2, x3 > f.algebraic_immunity() = 1 > f.annihilator(f.algebraic_immunity()) = None > f.algebraic_immunity(annihilator=True) = (1, x2 + 1) > f = x0*x2 + x2*x3 + 1 > g = x2 + 1 > g*f = x2 + 1 > > Therefore algebraic_immunity returns wrong degree. g*f = 0 for degree 2, > which is the correct answer. > > On Tuesday, February 12, 2013 6:35:05 PM UTC+1, akhil wrote: > > > > Hello, > > > > SAGE returns an incorrect annihilator when > algebraic_immunity(annihilator > > = True) is used in the following code: > > > > from sage.crypto.boolean_function import BooleanFunction > > R = BooleanPolynomialRing(4,'x') > > f1 = R.gen(0)*R.gen(1)*R.gen(2) + R.gen(0)*R.gen(1)*R.gen(3) + > > R.gen(0)*R.gen(2)*R.gen(3) + R.gen(1)*R.gen(2)*R.gen(3) + 1 > > annihilator_f1 = BooleanFunction(f1).algebraic_immunity(annihilator = > > True)[1] > > print (annihilator_f1 * f1) > > > > annihilator_f1 is incorrect, because the response comes as: > > > > x0 + x1 + x2 + x3 + 1 > > > > > > and not 0 as expected. > > > > The annihilator( ) function however, returns the correct answer, as > > checked with the following code: > > > > for i in range(1,f1.total_degree() + 1): > > if BooleanFunction(f1).annihilator(i) == None: > > continue > > else: > > p = BooleanFunction(f1).annihilator(i) > > print p > > print (p*f1 == 0) > > break > > > > Output: > > > > x0*x1*x2 + x1*x2*x3 > > True > > > > > > The above code was written in online notebook version of SAGE. > > > > Thanks, > > AKHIL. > > > > > > > > > > > > -- > You received this message because you are subscribed to the Google Groups > "sage-support" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to sage-support...@googlegroups.com <javascript:>. > To post to this group, send email to sage-s...@googlegroups.com<javascript:>. > > Visit this group at http://groups.google.com/group/sage-support. > For more options, visit https://groups.google.com/groups/opt_out. > ----------------------------------------- > > -- > name: Martin Albrecht > _pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x6532AFB4 > _otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF > _www: http://martinralbrecht.wordpress.com/ > _jab: martinr...@jabber.ccc.de <javascript:> -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/groups/opt_out.