Posted By

nicolaspar on 11/14/08


Tagged

md5 crypt ofuscar encodear y hashear ida vuelta


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

luman


Ofuscar strings


 / Published in: PHP
 

Ofuscar strings

  1. function obuscar($str, $key) {
  2. if( ! defined( 'obuscar_hash' ) ) define( 'obuscar_hash', '545487875458715154879664164' );
  3. srand( obuscar_hash );
  4. $salida = '';
  5. $total = strlen($str);
  6. for( $i = -1; ++$i < $total; ){
  7. for( $j = -1; ++$j < ord(substr($key, $i % strlen($key), 1)); ) $toss = rand(0, 255);
  8. $mascara = rand(0, 255);
  9. $salida .= chr( ord( substr( $str, $i, 1) ) ^ $mascara);
  10. }
  11. return $salida;
  12. }
  13.  
  14. echo obuscar('nicolas pardo','Mykey');
  15. echo "<hr>";
  16. echo obuscar('MS¬Š0­9k6g','Mykey');

Report this snippet  

You need to login to post a comment.