PHP code example of jarvis / md5

1. Go to this page and download the library: Download jarvis/md5 library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

jarvis / md5 example snippets


   

   namespace App\Http\Controllers\Test;

   use Illuminate\Http\Request;
   use App\Http\Controllers\Controller;
   use Md5Hasher;


   /**
    * Class JarvisController
    * @package App\Http\Controllers\Test
    */
   class JarvisController extends Controller
   {
       /**
        * 生成MD5加密值
        * @return mixed
        */
       public function md5(){
           //return app('jarvis-md5')->make('123456',['salt'=>'Jarvis']);
          return Md5Hasher::make('123456',['salt'=>'Jarvis']);
       }

       /**
        *检验是否正确
        */
       public function md5check(){

           //true
           //$bool = app('jarvis-md5')->check('123456','1f3653b1e691bac8a0cf38e84b416373',['salt'=>'Jarvis']);

           //false
           //$bool = app('jarvis-md5')->check('123456-','1f3653b1e691bac8a0cf38e84b416373',['salt'=>'Jarvis']);
           //dd($bool);

           $bool = Md5Hasher::check('123456-','1f3653b1e691bac8a0cf38e84b416373',['salt'=>'Jarvis']);
           dd($bool);
       }

   }