Skip to content
Snippets Groups Projects
Commit f4988cf0 authored by adrian.spycher's avatar adrian.spycher
Browse files

add decode_msg

parent 1709c409
No related branches found
No related tags found
No related merge requests found
......@@ -121,3 +121,15 @@ def fermat_factorization(n):
a += 1
return (a, b)
def decode_msg(M):
"""Decode a code UTF-8 in characters
Args:
M (uint): code UTF-8
Returns:
strings: a strings containing characters UTF-8
"""
return M.to_bytes((M.bit_length() + 7) // 8, "little").decode("utf-8")
from ast import For, arguments, parse
from cProfile import label
from operator import truediv
import sys
from algo import *
def main():
......@@ -52,5 +56,9 @@ def main():
for i in range(length):
M[i] = exponentiation_rapide(mu[i], d, n)
for m in M:
print(decode_msg(m), end='')
if __name__ == "__main__":
main()
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment