1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
| p = 29 ''' m = [ [21, 14, 22, 0, 18, 28], [19, 4, 3, 27, 0, 4], [26, 20, 12, 11, 21, 5], [21, 28, 22, 28, 7, 18], [18, 18, 19, 25, 8, 25], [25, 25, 3, 0, 10, 2], [11, 23, 25, 10, 12, 26], [4, 28, 21, 17, 28, 24], ] c = [ [16, 11, 14, 10, 16, 6], [20, 22, 12, 20, 19, 6], [25, 18, 3, 8, 13, 2], [16, 21, 8, 21, 14, 11], [8, 18, 5, 1, 26, 5], [2, 27, 8, 2, 26, 14], [18, 15, 11, 14, 1, 6], [14, 21, 18, 2, 25, 24], ] ''' #sage ciphertext = [ [14, 2, 15, 20, 7, 13], [20, 20, 6, 12, 13, 11], [0, 20, 10, 22, 28, 10], [13, 18, 3, 22, 4, 22], [5, 11, 3, 16, 6, 16], [6, 10, 25, 22, 22, 25], [18, 20, 6, 27, 8, 5], [5, 20, 19, 13, 3, 12], [3, 20, 0, 7, 17, 13], [17, 21, 7, 19, 7, 7], [25, 8, 10, 22, 6, 6], [13, 27, 18, 3, 20, 1], ] c=matrix(Zmod(p),ciphertext) key = matrix(Zmod(p),key1) ls = string.ascii_uppercase + '_.*' def mat2str(mat): s = "" for i in range(len(mat) * 6): s += ls[mat[i // 6][i % 6]] return s m=[[24, 14, 20, 26 ,10, 13], [14, 22 ,26, 19 , 7 , 4], [26, 12 ,24 ,18 ,19 , 4], [17 ,24 ,26 ,14 , 5, 26], [19 , 7 , 4 ,26 ,12 , 0], [19 ,17 , 8, 23 ,28 ,28], [ 1, 20 ,19, 26 ,19 , 7], [ 8, 18 ,26 , 8 ,18, 26], [ 1, 4 , 6, 8 ,13, 13], [ 8 ,13 , 6 ,26 ,14 , 5], [26 , 2 ,17 ,24, 15, 19], [14 ,11, 14 , 6 ,24, 27]] m=mat2str(m) flag = "begin{" + hashlib.md5(m.encode()).hexdigest() + "}" print(flag)
|