Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
RSA
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
nicolas.albanesi
RSA
Commits
d1d78a5a
Commit
d1d78a5a
authored
3 years ago
by
nicolas.albanesi
Browse files
Options
Downloads
Patches
Plain Diff
Cast the values to int when returning
parent
8d4a3b74
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main.py
+1
-1
1 addition, 1 deletion
src/main.py
src/private_key.py
+2
-2
2 additions, 2 deletions
src/private_key.py
with
3 additions
and
3 deletions
src/main.py
+
1
−
1
View file @
d1d78a5a
...
...
@@ -13,7 +13,7 @@ def decode_message(l: list):
# Décode chaque bloc avec la clé privée
for
m
in
msg
:
decoded
.
append
(
exp_rapide
(
m
,
int
(
d
)
,
n
))
decoded
.
append
(
exp_rapide
(
m
,
d
,
n
))
# Affiche le message dans le terminal
for
x
in
decoded
:
...
...
This diff is collapsed.
Click to expand it.
src/private_key.py
+
2
−
2
View file @
d1d78a5a
...
...
@@ -4,13 +4,13 @@ from euclide import *
def
find_p_q
(
n
):
for
p
in
range
(
3
,
int
(
n
/
2
),
2
):
if
(
n
/
p
).
is_integer
():
return
p
,
n
/
p
return
p
,
int
(
n
/
p
)
def
find_private_key
(
p
,
q
,
e
):
z
=
(
p
-
1
)
*
(
q
-
1
)
r
,
x
,
y
=
pgcd_etendu
(
e
,
z
)
return
(
x
%
z
)
return
int
(
x
%
z
)
if
__name__
==
'
__main__
'
:
n
=
124344401
#Clé publique 1.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment