|
|
|
@ -1,100 +1,191 @@
|
|
|
|
|
<!DOCTYPE html>
|
|
|
|
|
<html lang="fr">
|
|
|
|
|
<head>
|
|
|
|
|
<meta charset="UTF-8">
|
|
|
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
|
<title>Code César</title>
|
|
|
|
|
<link rel="stylesheet" href="../../CSS/Enigme.css"/>
|
|
|
|
|
<link rel="stylesheet" href="../../CSS/Home.css">
|
|
|
|
|
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
|
|
|
|
|
<style>
|
|
|
|
|
html{
|
|
|
|
|
background-image: url(../../../assets/img/Background5.jpg);
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
</head>
|
|
|
|
|
<body>
|
|
|
|
|
<div class="enigme">
|
|
|
|
|
<div class="titre_pre">
|
|
|
|
|
<div class="retour">
|
|
|
|
|
<a class="material-icons" id="home" href="../Home.html" style="font-size:36px;color:white;">home</a>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="sign">
|
|
|
|
|
<h1>
|
|
|
|
|
<span class="fast-flicker">c</span>
|
|
|
|
|
<span>es</span>
|
|
|
|
|
<span class="flicker">a</span>
|
|
|
|
|
<span>r</span>
|
|
|
|
|
</h1>
|
|
|
|
|
</div><br>
|
|
|
|
|
</div>
|
|
|
|
|
<h2>Consigne</h2><br>
|
|
|
|
|
<p class="enonce">
|
|
|
|
|
Écrire une fonction Decrypt qui prend en argument un essage crypté et une clé et qui retourne le message decrypté avec le code César.(les espace ne seront pas encodé.)
|
|
|
|
|
</p><br>
|
|
|
|
|
<h2>Rappel</h2><br>
|
|
|
|
|
<p class="rappel">Le code César (ou chiffre de César ) est un chiffrement par substitution, où chaque lettre est remplacée par une autre lettre se situant un peu plus loin dans l'alphabet. Par exemple A avec une clé 2 devient C.
|
|
|
|
|
</p><br>
|
|
|
|
|
<h2>Exemple</h2><br>
|
|
|
|
|
<p>Entrée :      Sortie :</p>
|
|
|
|
|
<p>'fbehu',3      cyber</p><br>
|
|
|
|
|
<h2>Aide</h2><br>
|
|
|
|
|
<html lang="en">
|
|
|
|
|
<head>
|
|
|
|
|
<meta charset="UTF-8" />
|
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
|
|
|
<title>Code Cesar</title>
|
|
|
|
|
<link
|
|
|
|
|
rel="stylesheet"
|
|
|
|
|
href="https://stackpath.bootstrapcdn.com/bootstrap/5.0.0-alpha1/css/bootstrap.min.css"
|
|
|
|
|
integrity="sha384-r4NyP46KrjDleawBgD5tp8Y7UzmLA05oM1iAEQ17CSuDqnUK2+k9luXQOfXJCJ4I"
|
|
|
|
|
crossorigin="anonymous"
|
|
|
|
|
/>
|
|
|
|
|
<script
|
|
|
|
|
src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js"
|
|
|
|
|
integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo"
|
|
|
|
|
crossorigin="anonymous"
|
|
|
|
|
></script>
|
|
|
|
|
<script
|
|
|
|
|
src="https://stackpath.bootstrapcdn.com/bootstrap/5.0.0-alpha1/js/bootstrap.min.js"
|
|
|
|
|
integrity="sha384-oesi62hOLfzrys4LxRF63OJCXdXDipiYWBnvTl9Y9/TRlw5xlKIEHpNyvvDShgf/"
|
|
|
|
|
crossorigin="anonymous"
|
|
|
|
|
></script>
|
|
|
|
|
<link
|
|
|
|
|
rel="stylesheet"
|
|
|
|
|
href="https://fonts.googleapis.com/icon?family=Material+Icons"
|
|
|
|
|
/>
|
|
|
|
|
<link rel="stylesheet" href="View/src/CSS/Enigme.css" />
|
|
|
|
|
</head>
|
|
|
|
|
<body>
|
|
|
|
|
<div class="container-fluid px-5">
|
|
|
|
|
<!-- First Row -->
|
|
|
|
|
<div class="row py-4">
|
|
|
|
|
<div class="col-9 d-flex align-items-center px-0">
|
|
|
|
|
<a
|
|
|
|
|
class="material-icons pl-0"
|
|
|
|
|
id="home"
|
|
|
|
|
href="index.php?action=goToHome"
|
|
|
|
|
style="font-size: 40px; color: white"
|
|
|
|
|
>home</a
|
|
|
|
|
>
|
|
|
|
|
</div>
|
|
|
|
|
<button
|
|
|
|
|
style="background-color: transparent; border: none"
|
|
|
|
|
onclick="displayHelp()"
|
|
|
|
|
class="col-3 d-flex align-items-center"
|
|
|
|
|
>
|
|
|
|
|
<div class="col-10 text-right px-3">
|
|
|
|
|
<p style="font-size: 14px; color: white"><b>Besoin d'aide ?</b></p>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-2 text-right">
|
|
|
|
|
<img
|
|
|
|
|
src="View/assets/img/Foxy.png"
|
|
|
|
|
alt="Logo"
|
|
|
|
|
class="rounded-circle moving-fox"
|
|
|
|
|
style="border: 1px solid #44fff6; width: 60px; height: 60px"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
<!-- End First Row -->
|
|
|
|
|
|
|
|
|
|
<!-- Second Row -->
|
|
|
|
|
<div class="row">
|
|
|
|
|
<!-- First Column -->
|
|
|
|
|
<div
|
|
|
|
|
class="col-3 rounded p-3"
|
|
|
|
|
style="background-color: #222831; min-height: 80vh; height: auto"
|
|
|
|
|
>
|
|
|
|
|
<h2 class="text-left py-3" style="color: #44fff6; font-weight: 500">
|
|
|
|
|
Code Cesar
|
|
|
|
|
</h2>
|
|
|
|
|
<p>
|
|
|
|
|
La fonction ord(char) de python permet de retourner l’Unicode (standard d’encodage de caractères) d'un caractère. Par exemple, ord('a') retourné '97' et ord('b’) retourne 98.
|
|
|
|
|
Écrire une fonction <b style="color : violet">Decrypt</b> qui prend en argument un message et une clé
|
|
|
|
|
et qui retourne le message décrypté avec le code <b style="color: violet;">César</b>.(les espace ne seront pas encodé.)
|
|
|
|
|
</p>
|
|
|
|
|
<h3 class="text-left pb-3 pt-5" style="color: #44fff6">Rappel</h3>
|
|
|
|
|
<p>
|
|
|
|
|
Le code César (ou chiffre de César ) est un chiffrement par substitution,
|
|
|
|
|
<br>où chaque lettre est remplacée par une autre lettre se situant un peu plus loin dans l'alphabet .
|
|
|
|
|
<br>Par exemple A avec une clé 2 devient C.
|
|
|
|
|
</p>
|
|
|
|
|
<h3 class="text-left pb-3 pt-5" style="color: #44fff6">Exemple</h3>
|
|
|
|
|
<p>Entrée :      Sortie :</p>
|
|
|
|
|
<p>'fbehu',3      cyber</p>
|
|
|
|
|
<h3
|
|
|
|
|
class="text-left pb-3 pt-5 help"
|
|
|
|
|
style="color: #44fff6; display: none"
|
|
|
|
|
>
|
|
|
|
|
Aide
|
|
|
|
|
</h3>
|
|
|
|
|
<p style="display: none" class="help">
|
|
|
|
|
La fonction ord(char) de python permet de retourner l'Unicode (standard d’encodage de caractères) d'un caractère.<br/>
|
|
|
|
|
Par exemple, ord('a') retourne '97' et ord('b')) retourne '98'.
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
<!-- End First Column -->
|
|
|
|
|
|
|
|
|
|
<!-- Second Column -->
|
|
|
|
|
<div class="col-5 pr-0">
|
|
|
|
|
<div class="ace rounded" id="editor">def Decrypt(text, key):
|
|
|
|
|
</div>
|
|
|
|
|
<div class='ace' id='editor'>def Decrypt(text, key):
|
|
|
|
|
result = ""
|
|
|
|
|
for i in range(len(text)):
|
|
|
|
|
char = text[i]
|
|
|
|
|
if(char==" "):
|
|
|
|
|
result+=" "
|
|
|
|
|
elif (char.isupper()):
|
|
|
|
|
result += chr((ord(char) - key-65) % 26 + 65)
|
|
|
|
|
else:
|
|
|
|
|
result += chr((ord(char) - key - 97) % 26 + 97)
|
|
|
|
|
return result</div>
|
|
|
|
|
<div class='compiler_class'>
|
|
|
|
|
<textarea id='console' readonly rows="30" cols="100"></textarea>
|
|
|
|
|
<div class="buttons">
|
|
|
|
|
<div>
|
|
|
|
|
</div>
|
|
|
|
|
<!-- End Second Column -->
|
|
|
|
|
|
|
|
|
|
<!-- Third Column -->
|
|
|
|
|
<div class="col-4">
|
|
|
|
|
<textarea
|
|
|
|
|
id="console"
|
|
|
|
|
readonly
|
|
|
|
|
style="width: 100%; min-height: 65vh; height: auto"
|
|
|
|
|
class="p-3 rounded"
|
|
|
|
|
></textarea>
|
|
|
|
|
|
|
|
|
|
<div class="row pt-5 text-center" style="cursor: pointer">
|
|
|
|
|
<div class="col-6">
|
|
|
|
|
<a onclick="run_init()" class="btn">
|
|
|
|
|
<span class="noAnimation">Run</span>
|
|
|
|
|
</a>
|
|
|
|
|
<a href="#m1-o" onclick="submit()" class="btn">
|
|
|
|
|
<span class="noAnimation">Submit</span>
|
|
|
|
|
<span>Run</span>
|
|
|
|
|
</a>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-6">
|
|
|
|
|
<button
|
|
|
|
|
onclick="submit()"
|
|
|
|
|
class="btn"
|
|
|
|
|
data-toggle="modal"
|
|
|
|
|
data-target="#modal"
|
|
|
|
|
>
|
|
|
|
|
<span>Submit</span>
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<!-- End Third Column -->
|
|
|
|
|
</div>
|
|
|
|
|
<!-- End Second Row -->
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="modal-container" id="m1-o" style="--m-background: transparent;">
|
|
|
|
|
<div class="modal">
|
|
|
|
|
<div id="containerResult">
|
|
|
|
|
<h1 id="result"></h1>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="buttons">
|
|
|
|
|
<div id="top">
|
|
|
|
|
<a href="#" class="btn">
|
|
|
|
|
<span class="noAnimation">x</span>
|
|
|
|
|
</a>
|
|
|
|
|
<!-- Modal -->
|
|
|
|
|
<div
|
|
|
|
|
class="modal fade"
|
|
|
|
|
id="modal"
|
|
|
|
|
tabindex="-1"
|
|
|
|
|
role="dialog"
|
|
|
|
|
aria-labelledby="exampleModalCenterTitle"
|
|
|
|
|
aria-hidden="true"
|
|
|
|
|
>
|
|
|
|
|
<div class="modal-dialog modal-dialog-centered" role="document">
|
|
|
|
|
<div class="modal-content">
|
|
|
|
|
<div class="modal-header">
|
|
|
|
|
<h2
|
|
|
|
|
class="modal-title"
|
|
|
|
|
id="exampleModalLongTitle"
|
|
|
|
|
style="color: black"
|
|
|
|
|
>
|
|
|
|
|
Results
|
|
|
|
|
</h2>
|
|
|
|
|
<button
|
|
|
|
|
type="button"
|
|
|
|
|
class="close"
|
|
|
|
|
data-dismiss="modal"
|
|
|
|
|
aria-label="Close"
|
|
|
|
|
>
|
|
|
|
|
<span aria-hidden="true">×</span>
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="modal-body">
|
|
|
|
|
<h5 id="result" style="color: black"></h5>
|
|
|
|
|
</div>
|
|
|
|
|
<div id="bottom">
|
|
|
|
|
<a href="TrianglePascal.html" class="btn" id="fleche">
|
|
|
|
|
<span class="noAnimation">Next</span>
|
|
|
|
|
<div class="modal-footer">
|
|
|
|
|
<a href="index.php?action=goToChuckNorris" class="btn" style="display: none" id="next">
|
|
|
|
|
<span>NEXT</span>
|
|
|
|
|
</a>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<!-- End Modal -->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<script src="https://ajaxorg.github.io/ace-builds/src-noconflict/ace.js" type="text/javascript" charset="utf-8"></script>
|
|
|
|
|
<script src="https://raw.githack.com/pythonpad/brython-runner/master/lib/brython-runner.bundle.js" type="text/javascript" charset="utf-8"></script>
|
|
|
|
|
<script src="../../JS/base.js"></script>
|
|
|
|
|
<script src="../../JS/cesarDecrypt.js"></script>
|
|
|
|
|
</body>
|
|
|
|
|
<script
|
|
|
|
|
src="https://ajaxorg.github.io/ace-builds/src-noconflict/ace.js"
|
|
|
|
|
type="text/javascript"
|
|
|
|
|
charset="utf-8"
|
|
|
|
|
></script>
|
|
|
|
|
<script
|
|
|
|
|
src="https://raw.githack.com/pythonpad/brython-runner/master/lib/brython-runner.bundle.js"
|
|
|
|
|
type="text/javascript"
|
|
|
|
|
charset="utf-8"
|
|
|
|
|
></script>
|
|
|
|
|
<script src="View/src/JS/base.js"></script>
|
|
|
|
|
<script src="View/src/JS/cesarDecrypt.js"></script>
|
|
|
|
|
</body>
|
|
|
|
|
</html>
|