passagemath-repl 10.5.28__py3-none-any.whl → 10.5.30__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- passagemath_repl-10.5.30.data/data/share/jupyter/kernels/sagemath/kernel.json +1 -0
- passagemath_repl-10.5.30.data/data/share/jupyter/kernels/sagemath/logo-64x64.png +0 -0
- passagemath_repl-10.5.30.data/data/share/jupyter/kernels/sagemath/logo.svg +352 -0
- {passagemath_repl-10.5.28.dist-info → passagemath_repl-10.5.30.dist-info}/METADATA +3 -3
- {passagemath_repl-10.5.28.dist-info → passagemath_repl-10.5.30.dist-info}/RECORD +95 -24
- {passagemath_repl-10.5.28.dist-info → passagemath_repl-10.5.30.dist-info}/top_level.txt +1 -0
- sage/ext_data/all__sagemath_repl.py +1 -0
- sage/interfaces/all__sagemath_repl.py +1 -0
- sage/repl/ipython_kernel/install.py +6 -8
- sage/tests/books/__init__.py +2 -0
- sage/tests/books/computational-mathematics-with-sagemath/__init__.py +1 -0
- sage/tests/books/computational-mathematics-with-sagemath/calculus_doctest.py +550 -0
- sage/tests/books/computational-mathematics-with-sagemath/combinat_doctest.py +1054 -0
- sage/tests/books/computational-mathematics-with-sagemath/domaines_doctest.py +444 -0
- sage/tests/books/computational-mathematics-with-sagemath/float_doctest.py +478 -0
- sage/tests/books/computational-mathematics-with-sagemath/graphique_doctest.py +255 -0
- sage/tests/books/computational-mathematics-with-sagemath/graphtheory_doctest.py +419 -0
- sage/tests/books/computational-mathematics-with-sagemath/integration_doctest.py +291 -0
- sage/tests/books/computational-mathematics-with-sagemath/linalg_doctest.py +455 -0
- sage/tests/books/computational-mathematics-with-sagemath/linsolve_doctest.py +422 -0
- sage/tests/books/computational-mathematics-with-sagemath/lp_doctest.py +235 -0
- sage/tests/books/computational-mathematics-with-sagemath/mpoly_doctest.py +561 -0
- sage/tests/books/computational-mathematics-with-sagemath/nonlinear_doctest.py +491 -0
- sage/tests/books/computational-mathematics-with-sagemath/numbertheory_doctest.py +156 -0
- sage/tests/books/computational-mathematics-with-sagemath/polynomes_doctest.py +406 -0
- sage/tests/books/computational-mathematics-with-sagemath/premierspas_doctest.py +181 -0
- sage/tests/books/computational-mathematics-with-sagemath/programmation_doctest.py +663 -0
- sage/tests/books/computational-mathematics-with-sagemath/recequadiff_doctest.py +393 -0
- sage/tests/books/computational-mathematics-with-sagemath/sol/__init__.py +1 -0
- sage/tests/books/computational-mathematics-with-sagemath/sol/calculus_doctest.py +265 -0
- sage/tests/books/computational-mathematics-with-sagemath/sol/combinat_doctest.py +218 -0
- sage/tests/books/computational-mathematics-with-sagemath/sol/domaines_doctest.py +60 -0
- sage/tests/books/computational-mathematics-with-sagemath/sol/float_doctest.py +142 -0
- sage/tests/books/computational-mathematics-with-sagemath/sol/graphique_doctest.py +106 -0
- sage/tests/books/computational-mathematics-with-sagemath/sol/graphtheory_doctest.py +54 -0
- sage/tests/books/computational-mathematics-with-sagemath/sol/integration_doctest.py +57 -0
- sage/tests/books/computational-mathematics-with-sagemath/sol/linalg_doctest.py +57 -0
- sage/tests/books/computational-mathematics-with-sagemath/sol/linsolve_doctest.py +26 -0
- sage/tests/books/computational-mathematics-with-sagemath/sol/lp_doctest.py +48 -0
- sage/tests/books/computational-mathematics-with-sagemath/sol/mpoly_doctest.py +116 -0
- sage/tests/books/computational-mathematics-with-sagemath/sol/nonlinear_doctest.py +112 -0
- sage/tests/books/computational-mathematics-with-sagemath/sol/numbertheory_doctest.py +168 -0
- sage/tests/books/computational-mathematics-with-sagemath/sol/polynomes_doctest.py +108 -0
- sage/tests/books/computational-mathematics-with-sagemath/sol/recequadiff_doctest.py +59 -0
- sage/tests/books/judson-abstract-algebra/__init__.py +1 -0
- sage/tests/books/judson-abstract-algebra/actions-sage-exercises.py +52 -0
- sage/tests/books/judson-abstract-algebra/actions-sage.py +174 -0
- sage/tests/books/judson-abstract-algebra/algcodes-sage.py +131 -0
- sage/tests/books/judson-abstract-algebra/boolean-sage.py +270 -0
- sage/tests/books/judson-abstract-algebra/cosets-sage-exercises.py +88 -0
- sage/tests/books/judson-abstract-algebra/cosets-sage.py +171 -0
- sage/tests/books/judson-abstract-algebra/crypt-sage.py +152 -0
- sage/tests/books/judson-abstract-algebra/cyclic-sage.py +451 -0
- sage/tests/books/judson-abstract-algebra/domains-sage.py +164 -0
- sage/tests/books/judson-abstract-algebra/fields-sage.py +300 -0
- sage/tests/books/judson-abstract-algebra/finite-sage.py +109 -0
- sage/tests/books/judson-abstract-algebra/galois-sage.py +485 -0
- sage/tests/books/judson-abstract-algebra/groups-sage.py +281 -0
- sage/tests/books/judson-abstract-algebra/homomorph-sage-exercises.py +66 -0
- sage/tests/books/judson-abstract-algebra/homomorph-sage.py +201 -0
- sage/tests/books/judson-abstract-algebra/integers-sage.py +198 -0
- sage/tests/books/judson-abstract-algebra/isomorph-sage.py +173 -0
- sage/tests/books/judson-abstract-algebra/normal-sage.py +134 -0
- sage/tests/books/judson-abstract-algebra/permute-sage.py +320 -0
- sage/tests/books/judson-abstract-algebra/poly-sage.py +301 -0
- sage/tests/books/judson-abstract-algebra/rings-sage.py +414 -0
- sage/tests/books/judson-abstract-algebra/sets-sage.py +164 -0
- sage/tests/books/judson-abstract-algebra/struct-sage.py +64 -0
- sage/tests/books/judson-abstract-algebra/sylow-sage.py +251 -0
- sage/tests/books/judson-abstract-algebra/vect-sage-exercises.py +49 -0
- sage/tests/books/judson-abstract-algebra/vect-sage.py +212 -0
- sage/tests/memcheck/__init__.py +1 -0
- sage/tests/memcheck/run_tests.py +25 -0
- sage/tests/memcheck/run_tests_in_valgrind.py +36 -0
- sage/tests/memcheck/symbolic_expression.py +12 -0
- sage/tests/memcheck/verify_no_leak.py +28 -0
- sage/tests/all.py +0 -0
- {passagemath_repl-10.5.28.data → passagemath_repl-10.5.30.data}/scripts/sage-cachegrind +0 -0
- {passagemath_repl-10.5.28.data → passagemath_repl-10.5.30.data}/scripts/sage-callgrind +0 -0
- {passagemath_repl-10.5.28.data → passagemath_repl-10.5.30.data}/scripts/sage-cleaner +0 -0
- {passagemath_repl-10.5.28.data → passagemath_repl-10.5.30.data}/scripts/sage-coverage +0 -0
- {passagemath_repl-10.5.28.data → passagemath_repl-10.5.30.data}/scripts/sage-eval +0 -0
- {passagemath_repl-10.5.28.data → passagemath_repl-10.5.30.data}/scripts/sage-fixdoctests +0 -0
- {passagemath_repl-10.5.28.data → passagemath_repl-10.5.30.data}/scripts/sage-inline-fortran +0 -0
- {passagemath_repl-10.5.28.data → passagemath_repl-10.5.30.data}/scripts/sage-ipynb2rst +0 -0
- {passagemath_repl-10.5.28.data → passagemath_repl-10.5.30.data}/scripts/sage-ipython +0 -0
- {passagemath_repl-10.5.28.data → passagemath_repl-10.5.30.data}/scripts/sage-massif +0 -0
- {passagemath_repl-10.5.28.data → passagemath_repl-10.5.30.data}/scripts/sage-notebook +0 -0
- {passagemath_repl-10.5.28.data → passagemath_repl-10.5.30.data}/scripts/sage-omega +0 -0
- {passagemath_repl-10.5.28.data → passagemath_repl-10.5.30.data}/scripts/sage-preparse +0 -0
- {passagemath_repl-10.5.28.data → passagemath_repl-10.5.30.data}/scripts/sage-run +0 -0
- {passagemath_repl-10.5.28.data → passagemath_repl-10.5.30.data}/scripts/sage-run-cython +0 -0
- {passagemath_repl-10.5.28.data → passagemath_repl-10.5.30.data}/scripts/sage-runtests +0 -0
- {passagemath_repl-10.5.28.data → passagemath_repl-10.5.30.data}/scripts/sage-startuptime.py +0 -0
- {passagemath_repl-10.5.28.data → passagemath_repl-10.5.30.data}/scripts/sage-valgrind +0 -0
- {passagemath_repl-10.5.28.dist-info → passagemath_repl-10.5.30.dist-info}/WHEEL +0 -0
@@ -0,0 +1,171 @@
|
|
1
|
+
# sage_setup: distribution = sagemath-repl
|
2
|
+
# sage.doctest: needs sage.groups sage.libs.pari
|
3
|
+
## Sage Doctest File ##
|
4
|
+
#**************************************#
|
5
|
+
#* Generated from PreTeXt source *#
|
6
|
+
#* on 2017-08-24T11:43:34-07:00 *#
|
7
|
+
#* *#
|
8
|
+
#* http://mathbook.pugetsound.edu *#
|
9
|
+
#* *#
|
10
|
+
#**************************************#
|
11
|
+
##
|
12
|
+
"""
|
13
|
+
Please contact Rob Beezer (beezer@ups.edu) with
|
14
|
+
any test failures here that need to be changed
|
15
|
+
as a result of changes accepted into Sage. You
|
16
|
+
may edit/change this file in any sensible way, so
|
17
|
+
that development work may procede. Your changes
|
18
|
+
may later be replaced by the authors of "Abstract
|
19
|
+
Algebra: Theory and Applications" when the text is
|
20
|
+
updated, and a replacement of this file is proposed
|
21
|
+
for review.
|
22
|
+
"""
|
23
|
+
##
|
24
|
+
## To execute doctests in these files, run
|
25
|
+
## $ $SAGE_ROOT/sage -t <directory-of-these-files>
|
26
|
+
## or
|
27
|
+
## $ $SAGE_ROOT/sage -t <a-single-file>
|
28
|
+
##
|
29
|
+
## Replace -t by "-tp n" for parallel testing,
|
30
|
+
## "-tp 0" will use a sensible number of threads
|
31
|
+
##
|
32
|
+
## See: http://www.sagemath.org/doc/developer/doctesting.html
|
33
|
+
## or run $ $SAGE_ROOT/sage --advanced for brief help
|
34
|
+
##
|
35
|
+
## Generated at 2017-08-24T11:43:34-07:00
|
36
|
+
## From "Abstract Algebra"
|
37
|
+
## At commit 26d3cac0b4047f4b8d6f737542be455606e2c4b4
|
38
|
+
##
|
39
|
+
## Section 6.5 Sage
|
40
|
+
##
|
41
|
+
r"""
|
42
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
43
|
+
|
44
|
+
sage: G = SymmetricGroup(3)
|
45
|
+
sage: a = G("(1,2)")
|
46
|
+
sage: H = G.subgroup([a])
|
47
|
+
sage: rc = G.cosets(H, side='right'); rc
|
48
|
+
[[(), (1,2)], [(2,3), (1,3,2)], [(1,2,3), (1,3)]]
|
49
|
+
|
50
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
51
|
+
|
52
|
+
sage: lc = G.cosets(H, side='left'); lc
|
53
|
+
[[(), (1,2)], [(2,3), (1,2,3)], [(1,3,2), (1,3)]]
|
54
|
+
|
55
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
56
|
+
|
57
|
+
sage: G = SymmetricGroup(3)
|
58
|
+
sage: b = G("(1,2,3)")
|
59
|
+
sage: H = G.subgroup([b])
|
60
|
+
sage: rc = G.cosets(H, side='right'); rc
|
61
|
+
[[(), (1,2,3), (1,3,2)], [(2,3), (1,3), (1,2)]]
|
62
|
+
|
63
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
64
|
+
|
65
|
+
sage: lc = G.cosets(H, side='left'); lc
|
66
|
+
[[(), (1,2,3), (1,3,2)], [(2,3), (1,2), (1,3)]]
|
67
|
+
|
68
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
69
|
+
|
70
|
+
sage: rc == lc
|
71
|
+
False
|
72
|
+
|
73
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
74
|
+
|
75
|
+
sage: rc_sorted = sorted([sorted(coset) for coset in rc])
|
76
|
+
sage: rc_sorted
|
77
|
+
[[(), (1,2,3), (1,3,2)], [(2,3), (1,2), (1,3)]]
|
78
|
+
|
79
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
80
|
+
|
81
|
+
sage: lc_sorted = sorted([sorted(coset) for coset in lc])
|
82
|
+
sage: lc_sorted
|
83
|
+
[[(), (1,2,3), (1,3,2)], [(2,3), (1,2), (1,3)]]
|
84
|
+
|
85
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
86
|
+
|
87
|
+
sage: rc_sorted == lc_sorted
|
88
|
+
True
|
89
|
+
|
90
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
91
|
+
|
92
|
+
sage: G = SymmetricGroup(3)
|
93
|
+
sage: sg = G.subgroups(); sg
|
94
|
+
[Subgroup generated by [()] of (Symmetric group of order 3! as a permutation group),
|
95
|
+
Subgroup generated by [(2,3)] of (Symmetric group of order 3! as a permutation group),
|
96
|
+
Subgroup generated by [(1,2)] of (Symmetric group of order 3! as a permutation group),
|
97
|
+
Subgroup generated by [(1,3)] of (Symmetric group of order 3! as a permutation group),
|
98
|
+
Subgroup generated by [(1,2,3)] of (Symmetric group of order 3! as a permutation group),
|
99
|
+
Subgroup generated by [(1,2,3), (2,3)] of (Symmetric group of order 3! as a permutation group)]
|
100
|
+
|
101
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
102
|
+
|
103
|
+
sage: H = sg[4]; H
|
104
|
+
Subgroup generated by [(1,2,3)] of (Symmetric group of order 3! as a permutation group)
|
105
|
+
|
106
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
107
|
+
|
108
|
+
sage: H.order()
|
109
|
+
3
|
110
|
+
|
111
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
112
|
+
|
113
|
+
sage: H.list()
|
114
|
+
[(), (1,2,3), (1,3,2)]
|
115
|
+
|
116
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
117
|
+
|
118
|
+
sage: H.is_cyclic()
|
119
|
+
True
|
120
|
+
|
121
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
122
|
+
|
123
|
+
sage: G = AlternatingGroup(4)
|
124
|
+
sage: sg = G.subgroups()
|
125
|
+
sage: [H.order() for H in sg]
|
126
|
+
[1, 2, 2, 2, 3, 3, 3, 3, 4, 12]
|
127
|
+
|
128
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
129
|
+
|
130
|
+
sage: G = SymmetricGroup(4)
|
131
|
+
sage: sg = G.subgroups()
|
132
|
+
sage: [H.order() for H in sg]
|
133
|
+
[1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4,
|
134
|
+
6, 6, 6, 6, 8, 8, 8, 12, 24]
|
135
|
+
|
136
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
137
|
+
|
138
|
+
sage: len(sg)
|
139
|
+
30
|
140
|
+
|
141
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
142
|
+
|
143
|
+
sage: G = CyclicPermutationGroup(20)
|
144
|
+
sage: [H.order() for H in G.subgroups()]
|
145
|
+
[1, 2, 4, 5, 10, 20]
|
146
|
+
|
147
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
148
|
+
|
149
|
+
sage: G = CyclicPermutationGroup(19)
|
150
|
+
sage: [H.order() for H in G.subgroups()]
|
151
|
+
[1, 19]
|
152
|
+
|
153
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
154
|
+
|
155
|
+
sage: n = 8
|
156
|
+
sage: G = CyclicPermutationGroup(n)
|
157
|
+
sage: [H.order() for H in G.subgroups()]
|
158
|
+
[1, 2, 4, 8]
|
159
|
+
|
160
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
161
|
+
|
162
|
+
sage: euler_phi(345)
|
163
|
+
176
|
164
|
+
|
165
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
166
|
+
|
167
|
+
sage: m = random_prime(10000)
|
168
|
+
sage: n = random_prime(10000)
|
169
|
+
sage: m, n, euler_phi(m*n) == euler_phi(m)*euler_phi(n) # random
|
170
|
+
(5881, 1277, True)
|
171
|
+
"""
|
@@ -0,0 +1,152 @@
|
|
1
|
+
# sage_setup: distribution = sagemath-repl
|
2
|
+
# sage.doctest: needs sage.libs.pari
|
3
|
+
## Sage Doctest File ##
|
4
|
+
#**************************************#
|
5
|
+
#* Generated from PreTeXt source *#
|
6
|
+
#* on 2017-08-24T11:43:34-07:00 *#
|
7
|
+
#* *#
|
8
|
+
#* http://mathbook.pugetsound.edu *#
|
9
|
+
#* *#
|
10
|
+
#**************************************#
|
11
|
+
##
|
12
|
+
"""
|
13
|
+
Please contact Rob Beezer (beezer@ups.edu) with
|
14
|
+
any test failures here that need to be changed
|
15
|
+
as a result of changes accepted into Sage. You
|
16
|
+
may edit/change this file in any sensible way, so
|
17
|
+
that development work may procede. Your changes
|
18
|
+
may later be replaced by the authors of "Abstract
|
19
|
+
Algebra: Theory and Applications" when the text is
|
20
|
+
updated, and a replacement of this file is proposed
|
21
|
+
for review.
|
22
|
+
"""
|
23
|
+
##
|
24
|
+
## To execute doctests in these files, run
|
25
|
+
## $ $SAGE_ROOT/sage -t <directory-of-these-files>
|
26
|
+
## or
|
27
|
+
## $ $SAGE_ROOT/sage -t <a-single-file>
|
28
|
+
##
|
29
|
+
## Replace -t by "-tp n" for parallel testing,
|
30
|
+
## "-tp 0" will use a sensible number of threads
|
31
|
+
##
|
32
|
+
## See: http://www.sagemath.org/doc/developer/doctesting.html
|
33
|
+
## or run $ $SAGE_ROOT/sage --advanced for brief help
|
34
|
+
##
|
35
|
+
## Generated at 2017-08-24T11:43:34-07:00
|
36
|
+
## From "Abstract Algebra"
|
37
|
+
## At commit 26d3cac0b4047f4b8d6f737542be455606e2c4b4
|
38
|
+
##
|
39
|
+
## Section 7.6 Sage
|
40
|
+
##
|
41
|
+
r"""
|
42
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
43
|
+
|
44
|
+
sage: p_a = next_prime(10^10)
|
45
|
+
sage: q_a = next_prime(p_a)
|
46
|
+
sage: p_b = next_prime((3/2)*10^10)
|
47
|
+
sage: q_b = next_prime(p_b)
|
48
|
+
sage: n_a = p_a * q_a
|
49
|
+
sage: n_b = p_b * q_b
|
50
|
+
sage: n_a, n_b
|
51
|
+
(100000000520000000627, 225000000300000000091)
|
52
|
+
|
53
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
54
|
+
|
55
|
+
sage: m_a = euler_phi(n_a)
|
56
|
+
sage: m_b = euler_phi(n_b)
|
57
|
+
sage: m_a, m_b
|
58
|
+
(100000000500000000576, 225000000270000000072)
|
59
|
+
|
60
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
61
|
+
|
62
|
+
sage: factor(m_a)
|
63
|
+
2^6 * 3 * 11 * 17 * 131 * 521 * 73259 * 557041
|
64
|
+
|
65
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
66
|
+
|
67
|
+
sage: E_a = 5*23
|
68
|
+
sage: D_a = inverse_mod(E_a, m_a)
|
69
|
+
sage: D_a
|
70
|
+
20869565321739130555
|
71
|
+
|
72
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
73
|
+
|
74
|
+
sage: factor(m_b)
|
75
|
+
2^3 * 3^4 * 107 * 1298027 * 2500000001
|
76
|
+
|
77
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
78
|
+
|
79
|
+
sage: E_b = 7*29
|
80
|
+
sage: D_b = inverse_mod(E_b, m_b)
|
81
|
+
sage: D_b
|
82
|
+
24384236482463054195
|
83
|
+
|
84
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
85
|
+
|
86
|
+
sage: print("Alice's public key, n:", n_a, "E:", E_a)
|
87
|
+
Alice's public key, n: 100000000520000000627 E: 115
|
88
|
+
|
89
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
90
|
+
|
91
|
+
sage: print("Alice's private key, D:", D_a)
|
92
|
+
Alice's private key, D: 20869565321739130555
|
93
|
+
|
94
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
95
|
+
|
96
|
+
sage: print("Bob's public key, n:", n_b, "E:", E_b)
|
97
|
+
Bob's public key, n: 225000000300000000091 E: 203
|
98
|
+
|
99
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
100
|
+
|
101
|
+
sage: print("Bob's private key, D:", D_b)
|
102
|
+
Bob's private key, D: 24384236482463054195
|
103
|
+
|
104
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
105
|
+
|
106
|
+
sage: word = 'Sage'
|
107
|
+
sage: digits = [ord(letter) for letter in word]
|
108
|
+
sage: digits
|
109
|
+
[83, 97, 103, 101]
|
110
|
+
|
111
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
112
|
+
|
113
|
+
sage: message = ZZ(digits, 128)
|
114
|
+
sage: message
|
115
|
+
213512403
|
116
|
+
|
117
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
118
|
+
|
119
|
+
sage: signed = power_mod(message, D_a, n_a)
|
120
|
+
sage: signed
|
121
|
+
47838774644892618423
|
122
|
+
|
123
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
124
|
+
|
125
|
+
sage: encrypted = power_mod(signed, E_b, n_b)
|
126
|
+
sage: encrypted
|
127
|
+
111866209291209840488
|
128
|
+
|
129
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
130
|
+
|
131
|
+
sage: decrypted = power_mod(encrypted, D_b, n_b)
|
132
|
+
sage: decrypted
|
133
|
+
47838774644892618423
|
134
|
+
|
135
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
136
|
+
|
137
|
+
sage: received = power_mod(decrypted, E_a, n_a)
|
138
|
+
sage: received
|
139
|
+
213512403
|
140
|
+
|
141
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
142
|
+
|
143
|
+
sage: digits = received.digits(base=128)
|
144
|
+
sage: letters = [chr(ascii) for ascii in digits]
|
145
|
+
sage: letters
|
146
|
+
['S', 'a', 'g', 'e']
|
147
|
+
|
148
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
149
|
+
|
150
|
+
sage: ''.join(letters)
|
151
|
+
'Sage'
|
152
|
+
"""
|