Skip to content

Instantly share code, notes, and snippets.

View Swizzzer's full-sized avatar
😴
Breathing

Swizzer Swizzzer

😴
Breathing
  • Harbin Institute of Technology, Shenzhen
View GitHub Profile
@Swizzzer
Swizzzer / is_linear_sbox.py
Last active June 30, 2025 17:51
Simple script to determine if an S-Box is linear
from sage.crypto.boolean_function import BooleanFunction
def is_linear_sbox(sbox: list[int]) -> bool:
input_size = (len(sbox) - 1).bit_length()
output_size = max(sbox).bit_length()
print(f"[*] Input bits: {input_size}, Output bits: {output_size}")
is_linear = True