Skip to content

Instantly share code, notes, and snippets.

@pfasante
pfasante / milp-clyde-dp.sage
Created March 18, 2020 12:09
MILP Model for Division Property Analysis of Clyde-128
from sage.crypto.boolean_function import BooleanFunction
from sage.crypto.sbox import SBox
def algebraic_normal_form(self):
"""
Computes the algebraic normal forms (ANFs) of every coordinate.
"""
n = self.input_size()
return [self.component_function(i).algebraic_normal_form()
@pfasante
pfasante / sboxes_4bit_ae_classes.py
Created June 25, 2018 17:10
Affine Equivalence Classes of 4-bit S-boxes
from sage.crypto.sbox import SBox
# List taken from De Canniere's PhD Thesis
# Available at http://blog.sciencenet.cn/upload/blog/file/2009/3/20093320521938772.pdf
representatives = [
SBox([0x4, 0x0, 0x1, 0xF, 0x2, 0xB, 0x6, 0x7, 0x3, 0x9, 0xA, 0x5, 0xC, 0xD, 0xE, 0x8]),
SBox([0x8, 0x0, 0x1, 0xC, 0x2, 0x5, 0x6, 0x9, 0x4, 0x3, 0xA, 0xB, 0x7, 0xD, 0xE, 0xF]),
SBox([0x8, 0x0, 0x1, 0xC, 0xF, 0x5, 0x6, 0x7, 0x4, 0x3, 0xA, 0xB, 0x9, 0xD, 0xE, 0x2]),
SBox([0x2, 0x0, 0x1, 0x8, 0x3, 0xD, 0x6, 0x7, 0x4, 0x9, 0xA, 0x5, 0xC, 0xB, 0xE, 0xF]),

Keybase proof

I hereby claim:

  • I am pfasante on github.
  • I am asante (https://keybase.io/asante) on keybase.
  • I have a public key ASDYesrFb3Luez5HujWc-gNGQsC-yMuU4caqDn08L-uraQo

To claim this, I am signing this object: