login  Naam:   Wachtwoord: 
Registreer je!
 Scripts:

Scripts > PHP > Snippets > EN/DECRYPTIE functie's!

EN/DECRYPTIE functie's!

Auteur: Hendry - 06 februari 2005 - 22:42 - Gekeurd door: twopeak - Hits: 2714 - Aantal punten: 0.67 (3 stemmen)


ik denk dat dit een heel handig en makkelijk scriptje is voor mensen die geen md5 gebruiken en/of het niet vertrouwen in de toekomst ofzo...

bij deze mijn EN/DECRYPTIE functie's script!

Citaat:
Crew-edit: Dit script laten we staan om te tonen hoe moeilijk het is om een encriptie script te maken.
Dit script is echt niet veilig. Lees de commentaar ivm. waarom het niet te vertrouwen is.

Code:

  1. <?php
  2. // ENCRYPTIE FUNCTIE
  3. function encrypt($password) {
  4.  
  5. $key = "ikbenhendryendezeencryptoriserggoednoujadathoopikteminstemorbitortororcitinciduntatporttitoreucongueaurnanullamtortorpedevolutpatsitametpharetraegetsuscipitidantesedtortormaurisfeugiataultricessedgravidanecdolor";
  6. $crypt = "";
  7. for($i=0;$i<strlen($password);$i++) {
  8. $i_key = ord(substr($key, $i, 1));
  9. $i_pass = ord(substr($password, $i, 1));
  10. $n_key = ord(substr($key, $i+1, 1));
  11. $i_crypt = $i_pass + $i_key;
  12. $i_crypt = $i_crypt - $n_key;
  13. if($i_crypt == 92) {
  14. $i_crypt = 251;
  15. }
  16. $crypt .= chr($i_crypt);
  17. }
  18. return $crypt;
  19. } //END encrypt() functie
  20.  
  21.  
  22. // DECRYPTIE FUNCTIE
  23. function decrypt($password) {
  24.  
  25. $key = "ikbenhendryendezeencryptoriserggoednoujadathoopikteminstemorbitortororcitinciduntatporttitoreucongueaurnanullamtortorpedevolutpatsitametpharetraegetsuscipitidantesedtortormaurisfeugiataultricessedgravidanecdolor";
  26. $crypt = "";
  27. $password = stripslashes($password);
  28. for($i=0;$i<strlen($password);$i++) {
  29. $i_key = ord(substr($key, $i, 1));
  30. $i_pass = ord(substr($password, $i, 1));
  31. if($i_pass == 251) {
  32. $i_pass = 92;
  33. }
  34. $n_key = ord(substr($key, $i+1, 1));
  35. $i_crypt = $i_pass + $n_key;
  36. $i_crypt = $i_crypt - $i_key;
  37. $crypt .= chr($i_crypt);
  38. }
  39. return $crypt;
  40. } //EINDE decrypt() functie
  41.  
  42.  
  43. echo encrypt("ditismijnwachtwoord");
  44. // echo'ed: = brq`yp`t`puZrsb&#8222;oio
  45.  
  46.  
  47. echo"<br><br>";
  48.  
  49.  
  50. echo decrypt("brq`yp`t`puZrsb&#8222;oio");
  51. // echo'ed: ditismijnwachtwoord
  52. ?>

Download code! Download code (.txt)

 Stemmen
Niet ingelogd

 Reacties
Post een reactie
Lees de reacties  ( 4 )
© 2002-2012 Sitemasters.be - Regels - Gehost door: Vircon - Laadtijd: 0.056s