qnibus/laravel-multi-hash

Jasypt, sha256, sha512, md5 integration for Laravel 9.x

0.9.3 2023-01-27 07:57 UTC

This package is auto-updated.

Last update: 2024-11-27 12:32:37 UTC


README

Requirement

  • laravel 9.x or later
  • php 8.x

Usage

  1. Input your command line in below command.

    composer require qnibus/laravel-multi-hash
  2. Open /config/hashing.php in your laravel application and modify.

    'driver' => 'jasypt',// 'md5', 'sha256', 'sha512' or 'jasypt'
  3. Your code anywhere...

    # make hash
    Hash::make('some string');
    // result: NDM1M2M0ZmQ3MWYzNmJiZIXQlXLOzKcLkUKAZ6p6NPBBDA0zGwVCDkFuLmvbeozd
    
    # check hash
    Hash::check('some string', 'NDM1M2M0ZmQ3MWYzNmJiZIXQlXLOzKcLkUKAZ6p6NPBBDA0zGwVCDkFuLmvbeozd');
    // result: true
  4. Publish package config to config directory in laravel.

    php artisan vendor:publish --tag=multi-hashing-config
  5. Modify option in /config/multi-hashing.php

Better use

# Usage for jasypt
Hash::driver('jasypt')->make('some string');
Hash::driver('jasypt')->check('some string', $hashedString);

# Usage for sha256
Hash::driver('sha256')->make('some string');
Hash::driver('sha256')->check('some string', $hashedString);

# Usage for sha512
Hash::driver('sha512')->make('some string');
Hash::driver('sha512')->check('some string', $hashedString);

# Usage for md5
Hash::driver('md5')->make('some string');
Hash::driver('md5')->check('some string', $hashedString);