encryption – Sagemath help: Introduction to Lattices

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]])

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]]])
    solution = P1.solve_right(P2) 
    flag = 1
    for s in solution: 
        flag *= s
        #print(f"flag: {flag}")
        if isinstance(flag, int): 
            print(f"flag found, {flag}, {i}") 

Read more here: Source link