Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
1143 connectés 

  FORUM HardWare.fr
  Programmation
  PHP

  Warning: The IV parameter must be as long as the blocksize

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

Warning: The IV parameter must be as long as the blocksize

n°271088
chrono
Ne m'appelez plus Dieu...
Posté le 17-12-2002 à 00:34:22  profilanswer
 

Voila... je comprends pas l'erreur retournée...
pouvez vous m'éclairer svp...

 
Fichier encrypte.php
<?
require_once("cryptage.inc.php" );
 
switch($action) {
 
//==================================
 
case "encrypte";
 
$motdepasse_crypt=encode($motdepasse);
             
echo "$motdepasse_crypt";
     
 
$motdepasse=decode($motdepasse_crypt);
 
echo "$motdepasse";
 
break;
 
//===================================
 
default;
 
echo "<center><h2>Cryptage</h2><br>
 
<form action=\"encrypte.php\" method=\"post\" >
 
Veuillez indiquer le mot de passe à crypter<br><input type=\"text\" name=\"motdepasse\"><br><br>
 
<input type=\"hidden\" name=\"action\" value=\"encrypte\"><input type=\"submit\" value=\"Envoyer\"></center>";
 
break;
 
}
//====================================
?>
 
Fichier cryptage.inc.php
<?
 
//www.php.net/manual/en/function.mcrypt-encrypt.php
 
 
function encode($motdepasse){
$motdepasse_crypt = mcrypt_ecb(MCRYPT_TripleDES, "Secret", $motdepasse, MCRYPT_ENCRYPT);
return $motdepasse_crypt;
}
 
function decode($motdepasse_crypt){
$motdepasse = mcrypt_ecb(MCRYPT_TripleDES, "Secret", $motdepasse_crypt, MCRYPT_DECRYPT);
return $motdepasse;
}
 
 
?>
 
L'erreur retournée...
 
Warning: attempt to use an empty IV, which is NOT recommend in /home/genob/www/bonvivre/cryptage/cryptage.inc.php on line 7
3Eå5tS±ëlÛ?á?Û
Warning: attempt to use an empty IV, which is NOT recommend in /home/genob/www/bonvivre/cryptage/cryptage.inc.php on line 12
motdepasse


Message édité par chrono le 17-12-2002 à 02:25:36
mood
Publicité
Posté le 17-12-2002 à 00:34:22  profilanswer
 

n°271095
omega2
Posté le 17-12-2002 à 01:09:25  profilanswer
 

Heu, le mot de passe serait il vide par hasard ?

n°271097
chrono
Ne m'appelez plus Dieu...
Posté le 17-12-2002 à 01:13:43  profilanswer
 

non...mais a mon avis, il test le champ vide au demarrage de la page "encrypte.php" donc comment empêcher ce 1 test?


Message édité par chrono le 17-12-2002 à 01:14:37
n°271098
chrono
Ne m'appelez plus Dieu...
Posté le 17-12-2002 à 01:25:12  profilanswer
 

C pas ce ke je croyais car G mis un texte par defaut ds le cas oula variable $motdepasse n'existe pas et ca m'affiche tjrs le même truc ki F chier...


Message édité par chrono le 17-12-2002 à 01:25:34
n°271102
chrono
Ne m'appelez plus Dieu...
Posté le 17-12-2002 à 02:22:01  profilanswer
 

je l'ai modifié et maintenant G ca..
 
 
Warning: The IV parameter must be as long as the blocksize in /home/genob/www/bonvivre/cryptage/cryptage.inc.php on line 10
ç@¯Ì].JaIÈ?]8k å)Ë?F?z¢|¥???y
Warning: The IV parameter must be as long as the blocksize in /home/genob/www/bonvivre/cryptage/cryptage.inc.php on line 17
ä\hU|?CTìíÏÈì???°ÀÁ"8?/*ù
 
 
et la modif est:
 
 
<?
 
// www.php.net/manual/en/function.mcrypt-encrypt.php
 
$iv = mcrypt_create_iv (mcrypt_get_iv_size (MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND);
$clef="Ceci est une clé secrète";
 
function encode($motdepasse)
{
$motdepasse_crypt = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $clef, $motdepasse, MCRYPT_MODE_ECB, $iv);
 
return $motdepasse_crypt;
}
 
function decode($motdepasse_crypt)
{
$motdepasse = mcrypt_ecb(MCRYPT_TripleDES, $clef, $motdepasse_crypt, MCRYPT_DECRYPT, $iv);
 
return $motdepasse;
}
 
 
?>


Message édité par chrono le 17-12-2002 à 02:23:26

Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  PHP

  Warning: The IV parameter must be as long as the blocksize

 

Sujets relatifs
Inverser partie haute et partie basse d'un longDelphi 4 + BD : Un moyen pour avoir des nombre vraiment long
int et longpt prob de newb -> Warning: mysql_num_rows(): supplied argument is not
Problème avec la fonction mail(..) --> "Warning serveur error"Comment convertir un long en String ??
[PHP] Warning: SAFE MODE Restriction in effect.Un long timer de plus de 60 000 c possible ?
Un FOR trop long ??...[MySQL] Acces avec des outils a la base super long
Plus de sujets relatifs à : Warning: The IV parameter must be as long as the blocksize


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR