Skip to content

Commit

Permalink
fixed algebraic tests in cipher_test.py due to removal of connection …
Browse files Browse the repository at this point in the history
…polynomials
  • Loading branch information
Sharwan Tiwari authored and Sharwan Tiwari committed Mar 21, 2024
1 parent 8aafd3e commit 262a5bb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
6 changes: 6 additions & 0 deletions claasp/cipher_modules/models/algebraic/algebraic_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,12 @@ def polynomial_system(self):
sage: AlgebraicModel(aes).polynomial_system()
Polynomial Sequence with 206 Polynomials in 136 Variables
sage: from claasp.ciphers.block_ciphers.tea_block_cipher import TeaBlockCipher
sage: from claasp.cipher_modules.models.algebraic.algebraic_model import AlgebraicModel
sage: tea = TeaBlockCipher(block_bit_size=32, key_bit_size=64, number_of_rounds=1)
sage: AlgebraicModel(tea).polynomial_system()
Polynomial Sequence with 368 Polynomials in 464 Variables
"""
polynomials = []
for r in range(self._cipher.number_of_rounds):
Expand Down
9 changes: 5 additions & 4 deletions tests/unit/cipher_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,8 @@ def test_impossible_differential_search():


def test_is_algebraically_secure():
identity = IdentityBlockCipher()
assert identity.is_algebraically_secure(120) is False
aes = AESBlockCipher(word_size=4, state_size=2, number_of_rounds = 1)
assert aes.is_algebraically_secure(10) is False


def test_is_andrx():
Expand Down Expand Up @@ -233,12 +233,13 @@ def test_is_spn():


def test_polynomial_system():
assert str(IdentityBlockCipher().polynomial_system()) == 'Polynomial Sequence with 128 Polynomials in 256 Variables'
tea = TeaBlockCipher(block_bit_size=32, key_bit_size=64, number_of_rounds=1)
assert str(tea.polynomial_system()) == 'Polynomial Sequence with 368 Polynomials in 464 Variables'


def test_polynomial_system_at_round():
assert str(FancyBlockCipher(number_of_rounds=1).polynomial_system_at_round(0)) == \
'Polynomial Sequence with 252 Polynomials in 288 Variables'
'Polynomial Sequence with 252 Polynomials in 168 Variables'


def test_print():
Expand Down

0 comments on commit 262a5bb

Please sign in to comment.