user7354735
user7354735

Reputation: 83

What the URL Encryption ways in laravel?

I am passing the POST Id values through the URL like this

localhost:81/laravel/public/Application/1956458 

So I would like to encrypt the Keys in the address bar. How can i achieve that?

Upvotes: 1

Views: 2110

Answers (2)

K.Suthagar
K.Suthagar

Reputation: 2306

There are some different ways to Encrypt your password,

1. Normal Encryption.

This is a strong AES encryption via the Mcrypt PHP extension,

$encrypted = Crypt::encrypt($id);

And also you can decrypt this encrypted values using this command,

$decrypted = Crypt::decrypt($encrypted);

2. Hashing A Password Using Bcrypt in Laravel.

This will create a hashed password. You may use it in your controller or even in a model.

$encrypted = Hash::make($id);

3. Direct Use Bcrypt.

In Laravel 5 you can directly encrypt the password using Bcrypt,

$encrypted = bcrypt($id);     

Upvotes: 2

user7356399
user7356399

Reputation: 85

Use this code to encrypt and decrypt

$encrypt_val = Crypt::encrypt($value);
$decrypt_val = Crypt::decrypt($encrypt_val );

when you use decrypt please insertuse Illuminate\Contracts\Encryption\DecryptException;

Upvotes: 2

Related Questions