Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
| Download
Path: Assignment 04/A04.ipynb
Views: 52Image: ubuntu2204
Kernel: SageMath 10.1
In [6]:
Message field elements: [a^6 + a^5 + a^3 + 1, a^6 + a^5 + a^3 + a^2, a^6 + a^5 + a^3 + a^2 + a + 1, a^6 + a^5 + a^4 + a^2 + a, a^6 + a^5 + a^2 + 1, a^6 + a^5 + a^4 + a^3 + 1, a^6 + a^5 + a^3 + a^2 + a + 1, a^6 + a^5 + a^4 + a^2 + 1]
Encoded message: [105, 108, 111, 118, 101, 121, 111, 117, 168, 152]
Trying combination: (0, 1, 2, 3, 4, 5, 6, 7)
Lagrange polynomial: (a^6 + a^3 + a^2 + a + 1)*s^7 + (a^7 + a^6 + a^4 + a^3 + 1)*s^6 + (a^7 + a^6 + a^5 + a^3)*s^5 + (a^5 + a^4 + a^3 + a^2 + a + 1)*s^4 + (a^5 + a^4 + a^3 + a^2 + a + 1)*s^3 + (a^6 + a^3 + 1)*s^2 + (a^5 + a + 1)*s + a^6 + a^5 + a^4 + a^3 + a^2 + 1
Decoded message: [105, 108, 111, 118, 101, 121, 111, 117]
Decoded message from expected_encoded_message: b'iloveyou'
Trying combination: (0, 1, 2, 3, 4, 5, 6, 7)
Lagrange polynomial: (a^6 + a^5 + a^3 + 1)*s^7 + (a^5 + a^3 + a^2 + 1)*s^6 + (a^6 + a^4 + a^2)*s^5 + (a^5 + a^4 + a^3 + 1)*s^4 + (a^6 + a^5 + a^2 + 1)*s^3 + (a^6 + a^5 + a^4 + a^2)*s^2 + (a^4 + a^3 + 1)*s + a^6 + a^3
Decoded message: [105, 108, 111, 118, 51, 121, 111, 117]
Decoded message from recoverable_encoded_message_1: b'ilov3you'
Decoding of recoverable_encoded_message_1 failed
In [5]:
---------------------------------------------------------------------------
AssertionError Traceback (most recent call last)
Cell In [5], line 33
30 recoverable_encoded_message_2 = b'iloveyou\xa8#'
31 unrecoverbe_encoded_message = b'il0v3you\xa8#'
---> 33 assert baby_rs_encode(message) == expected_encoded_message
34 assert baby_rs_decode(expected_encoded_message) == message
35 assert baby_rs_decode(recoverable_encoded_message_1) == message
AssertionError:
In [0]: