Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

All published worksheets from http://sagenb.org

Views: 168694
Image: ubuntu2004
prime_range(10000,11000)
[10007, 10009, 10037, 10039, 10061, 10067, 10069, 10079, 10091, 10093, 10099, 10103, 10111, 10133, 10139, 10141, 10151, 10159, 10163, 10169, 10177, 10181, 10193, 10211, 10223, 10243, 10247, 10253, 10259, 10267, 10271, 10273, 10289, 10301, 10303, 10313, 10321, 10331, 10333, 10337, 10343, 10357, 10369, 10391, 10399, 10427, 10429, 10433, 10453, 10457, 10459, 10463, 10477, 10487, 10499, 10501, 10513, 10529, 10531, 10559, 10567, 10589, 10597, 10601, 10607, 10613, 10627, 10631, 10639, 10651, 10657, 10663, 10667, 10687, 10691, 10709, 10711, 10723, 10729, 10733, 10739, 10753, 10771, 10781, 10789, 10799, 10831, 10837, 10847, 10853, 10859, 10861, 10867, 10883, 10889, 10891, 10903, 10909, 10937, 10939, 10949, 10957, 10973, 10979, 10987, 10993]
p=10007 q=10993 n=p*q n
110006951
phi=(p-1)*(q-1) phi
109985952
prime_divisors(phi)
[2, 3, 229, 5003]
e=5005 gcd(phi,5005)
1
d=inverse_mod(e,phi) d (e*d-1)/phi from sage.crypto.util import ascii_to_bin m1 = ascii_to_bin('MA') m2 = ascii_to_bin('TH') m3 = ascii_to_bin('EM') m4 = ascii_to_bin('AT') m5 = ascii_to_bin('IC') m6 = ascii_to_bin('S ') m=[m1,m2,m3,m4,m5,m6] m
[0100110101000001, 0101010001001000, 0100010101001101, 0100000101010100, 0100100101000011, 0101001100100000]
int(m[1].decoding())
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "_sage_input_32.py", line 9, in <module> exec compile(ur'open("___code___.py","w").write("# -*- coding: utf-8 -*-\n" + _support_.preparse_worksheet_cell(base64.b64decode("aW50KG1bMV0uZGVjb2RpbmcoKSk="),globals())+"\n"); execfile(os.path.abspath("___code___.py"))' + '\n', '', 'single') File "", line 1, in <module> File "/tmp/tmpg8x8hS/___code___.py", line 3, in <module> exec compile(ur'int(m[_sage_const_1 ].decoding())' + '\n', '', 'single') File "", line 1, in <module> ValueError: invalid literal for int() with base 10: 'TH'
m=0100110101000001 power_mod(m,e,n)
51674505