mirror of
https://github.com/arthur-pbty/nsi.git
synced 2026-06-03 23:36:19 +02:00
120 lines
4.5 KiB
HTML
120 lines
4.5 KiB
HTML
|
|
|
|
<html>
|
|
|
|
<head>
|
|
<title>Exercice 4.4</title>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
|
<meta name="generator" content="HelpNDoc Personal Edition 6.3.0.298">
|
|
<meta name="description" content="" />
|
|
<meta name="keywords" content="">
|
|
|
|
|
|
|
|
<link type="text/css" rel="stylesheet" media="all" href="css/reset.css" />
|
|
<link type="text/css" rel="stylesheet" media="all" href="css/base.css" />
|
|
<link type="text/css" rel="stylesheet" media="all" href="css/hnd.css" />
|
|
<!--[if lte IE 8]>
|
|
<link type="text/css" rel="stylesheet" media="all" href="css/ielte8.css" />
|
|
<![endif]-->
|
|
<style type="text/css">
|
|
#topic_header
|
|
{
|
|
background-color: #EFEFEF;
|
|
}
|
|
</style>
|
|
<script type="text/javascript" src="js/jquery.min.js"></script>
|
|
<script type="text/javascript" src="js/hnd.js"></script>
|
|
<script type="text/javascript">
|
|
$(document).ready(function()
|
|
{
|
|
if (top.frames.length == 0)
|
|
{
|
|
var sTopicUrl = top.location.href.substring(top.location.href.lastIndexOf("/") + 1, top.location.href.length);
|
|
top.location.href = "Activite_decouverte_Python.hml?" + sTopicUrl;
|
|
}
|
|
else
|
|
{
|
|
var bTocSelected = false;
|
|
(function waitForTOC()
|
|
{
|
|
if (top && top.FrameTOC && top.FrameTOC.SelectTocItem)
|
|
{
|
|
top.FrameTOC.SelectTocItem("Exercice44");
|
|
bTocSelected = true;
|
|
}
|
|
if (!bTocSelected) setTimeout(function() { waitForTOC(); }, 300);
|
|
})();
|
|
}
|
|
});
|
|
</script>
|
|
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
|
|
|
|
|
|
<div id="topic_header">
|
|
<div id="topic_header_content">
|
|
<h1 id="topic_header_text">Exercice 4.4</h1>
|
|
|
|
|
|
<div id="topic_breadcrumb">
|
|
<a href="Lesfonctions.html">Les fonctions</a> ›› <a href="Exercices4.html">Exercices 4</a> ››
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div id="topic_header_nav">
|
|
|
|
|
|
<a href="Exercices4.html"><img src="img/arrow_up.png" alt="Parent"/></a>
|
|
|
|
|
|
|
|
<a href="Exercice43.html"><img src="img/arrow_left.png" alt="Previous"/></a>
|
|
|
|
|
|
|
|
<a href="Exercice45.html"><img src="img/arrow_right.png" alt="Next"/></a>
|
|
|
|
|
|
</div>
|
|
|
|
<div class="clear"></div>
|
|
</div>
|
|
|
|
|
|
<div id="topic_content">
|
|
|
|
<p></p>
|
|
<p class="rvps7"><span class="rvts47">★</span><br/><span class="rvts11">1) A l'aide de la fonction </span><span class="rvts17">randint()</span><span class="rvts11"> du module </span><span class="rvts17">random</span><span class="rvts11">, écrire une fonction qui retourne un mot de passe de longueur N (chiffres, lettres minuscules ou majuscules).</span><br/><span class="rvts11">On donne :</span><br/><span class="rvts58">chaine = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'</span></p>
|
|
<p class="rvps8"><span class="rvts37">>>></span><span class="rvts38"> </span><span class="rvts40">print</span><span class="rvts38">(password(10))</span><br/><span class="rvts41">mHVeC5rs8P</span><br/><span class="rvts37">>>></span><span class="rvts38"> </span><span class="rvts40">print</span><span class="rvts38">(password(6))</span><br/><span class="rvts41">PYthoN</span></p>
|
|
<p class="rvps7"><span class="rvts11">2) Reprendre la question 1) avec la fonction </span><span class="rvts17">choice()</span><span class="rvts11"> du module </span><span class="rvts17">random</span><span class="rvts11">.</span><br/><span class="rvts11">Pour obtenir de l'aide sur cette fonction :</span></p>
|
|
<p class="rvps8"><span class="rvts37">>>></span><span class="rvts38"> </span><span class="rvts46">import</span><span class="rvts38"> random</span><br/><span class="rvts37">>>></span><span class="rvts38"> </span><span class="rvts40">help</span><span class="rvts38">(random.choice)</span></p>
|
|
<p class="rvps7"><span class="rvts11">3) Quel est le nombre de combinaisons possibles ?</span><br/><span class="rvts11">4) Quelle durée faut-il pour casser le mot de passe avec un logiciel capable de générer 1 million de combinaisons par seconde ?</span></p>
|
|
<p class="rvps7"><span class="rvts49">Lien utile : </span><a class="rvts85" href="http://www.exhaustif.com/Generateur-de-mot-de-passe-en.html">www.exhaustif.com/Generateur-de-mot-de-passe-en.html</a></p>
|
|
<p></p>
|
|
<p class="rvps4" style="clear: both;"><span class="rvts15">Créé avec HelpNDoc Personal Edition: </span><a class="rvts16" href="https://www.helpndoc.com/fr/tour-des-fonctionnalites/generation-de-site-web-iphone">Sites web iPhone faciles</a></p>
|
|
|
|
</div>
|
|
|
|
|
|
<div id="topic_footer">
|
|
|
|
<div id="topic_footer_content">
|
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
|
|
</body>
|
|
|
|
</html>
|
|
|