-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How do I set the salt? #21
Comments
Once you've installed the package, as in the installation guide, you should run the command below to publish the configuration file. Run the following in the root folder of your application: php artisan config:publish mitch/hashids This should publish the configuration file |
How can I use different salts? |
@plutus78 How do you mean? |
When I use it the laravel style: it always uses the same salt to calculate the hash. But I need differens Generators with different salts because I have different entities I want to secure. Without your laravel implementation I can use:
But how can I do it with your implementation? |
I don't think its possible out of the box with this package. You could set your own configuration and fetch them with the $hash = new Hashids(Config::get('myconfig.key')); |
the alphabet is not the same as salt, and as @plutus78 says, the salt can change depending the context, @vinkla thanks for a solution =) hope someday could be like a method to change it, like Hashids::salt('my_salt'); Thanks! |
I have a solution!! :D
This $app['config']['app.key'] To this $app['config']['hashids::salt']
'salt' => 'THIS_IS_YOUR_SALT' And on your config (\app\config\packages\mitch\hashids\config.php) change the values and you'r done!! with this, you can set the salt and you'r not forced to use the crypt one =) however, you can't change it in runtime =( A variation, you can change the line to $app['config']['app.hashid_salt'] and on config, you can add a different key per environment and you can get it with Config::get('app.hashid_salt'); but you can't change it in runtime too =( |
Related mitchellvanw#21
I've created an Laravel 5 supported version of this package https://github.com/vinkla/hashids This version supports multiple salts and connections. 'connections' => [
'main' => [
'salt' => 'your-salt-string',
'length' => 'your-length-integer',
'alphabet' => 'your-alphabet-string'
],
'alternative' => [
'salt' => 'your-salt-string',
'length' => 'your-length-integer',
'alphabet' => 'your-alphabet-string'
],
] |
A random is generated? how/where can I see it? how can I set/change it? the salt it's important!
thanks!
The text was updated successfully, but these errors were encountered: