0
$\begingroup$

part 1problem Hi im doing a problem from the Chapter Lightweight Introduction to Lattices in "Learning and Experiencing Cryptography with CrypTool and SageMath"

I'm curious if my implementation is wrong since I'm trying to measure a solution as a whole number as opposed to fraction. I've tried searching for common leetspeak words like 1337 or 5463 as the example gave in the question but couldn't find much. I'll attach my code and an image of the question. I'm also using sage to do this to improve. I'd appreciate any help. Thanks

from itertools import permutations

P1 = matrix([[33,79,29,41,47],[79,27,39,79,44],[90,83,58,1,90],[38,32,13,15,96],[72,82,88,83,23]])
print(P1) 

numbers = [73300,167887,243754,254984,458756]
combinations = permutations(numbers, len(numbers)) 

for i, combo in enumerate(combinations, 1):
    P2 = Matrix([[combo[0]], [combo[1]], [combo[2]], [combo[3]], [combo[4]]])
    #print(P2,"\n")
    solution = P1.solve_right(P2) 
    #print(solution) 
    flag = 1
    for s in solution: 
        flag *= s
        #print(f"flag: {flag}")
        if isinstance(flag, int): 
            print(f"flag found, {flag}, {i}") 
$\endgroup$
1
  • $\begingroup$ This is rather programming question that you may benefit the ask.sagemath. The programming/coding part is off-topic here. $\endgroup$
    – kelalaka
    Sep 17, 2023 at 9:11

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.