Ticket #6454: trac_6454_review.patch

File trac_6454_review.patch, 1.0 KB (added by ylchapuy, 14 years ago)
  • sage/crypto/mq/sbox.py

    # HG changeset patch
    # User Yann Laigle-Chapuy <yannlaiglechapuy@gmail.com>
    # Date 1246450354 -7200
    # Node ID 1846253c45455c339b627491cb4d1107ca12d0bd
    # Parent  7c5c8a61a57b7720828b7dbfa87fff3b9d6444b1
    add an indirect doctest
    
    diff -r 7c5c8a61a57b -r 1846253c4545 sage/crypto/mq/sbox.py
    a b  
    492492        ncols = 1<<n
    493493
    494494        def _walsh_transform(f):
     495            """
     496            Compute the Walsh transform of `f` in place.
     497
     498            EXAMPLE::
     499
     500                sage: S = mq.SBox(3,2,7,1)
     501                sage: S.linear_approximation_matrix() # indirect doctest
     502                [ 2 -1 -1  0  1  0  0 -1]
     503                [ 0 -1 -1  2 -1  0  0  1]
     504                [ 0  1 -1  0  1  0 -2  1]
     505                [ 0 -1  1  0  1 -2  0  1]
     506
     507            NOTE: internal use only; we use the specific dimension of the S-Box.
     508            """
    495509            for ldk in xrange(1,m+1):
    496510                k  = 1<<ldk
    497511                kh = k//2