  | 
              
	              
	                
  
    
	 
        PHP มีฟังชั่นเข้าระหัสแบบใส่พาสเวิร์ดมั้ยคับ อยากให้การเข้าระหัสแต่ละครั้ง ได้ค่าไม่เหมือนกันครับ     | 
   
  
    |   | 
   
 
 
 
              
  
          
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 Code (PHP) 
<?php
include('rsa.class.php');
$RSA = new RSA();
/* Example */
echo"<i>Keys:</i><br />";
$keys = $RSA->generate_keys ('9990454949', '9990450271', 1);
$message="hello world";
$encoded = $RSA->encrypt ($message, $keys[1], $keys[0], 5);
$decoded = $RSA->decrypt ($encoded, $keys[2], $keys[0]);
echo "<b>Message:</b> $message<br />\n";
echo "<b>Encoded:</b> $encoded<br />\n";
echo "<b>Decoded:</b> $decoded<br />\n";
echo "Success: ".(($decoded == $message) ? "True" : "False")."<hr />\n";
?>
                        
               
               | 
             
            
              
			                                
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2009-06-15 16:27:48 | 
                        By :
                            lozomac | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 Code (PHP) 
<?php
require_once('../AES128.php');
$str_data = "hello world";
$aes=new AES128();
$key=$aes->makeKey("0123456789abcdef");
$ct=$aes->blockEncrypt($str_data, $key);
$cpt=$aes->blockDecrypt($ct, $key);
echo("Data : $str_data <br> CipherText: $ct <br/> PlainText: $cpt <br/> ");
?>
 
 
download AES Class                        
               
               | 
             
            
              
			                                
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2009-06-15 17:13:42 | 
                        By :
                            lozomac | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
      		  
	
     | 
   
 
                 |