obfuscate_id | Mixes up record ids | Hashing library
kandi X-RAY | obfuscate_id Summary
kandi X-RAY | obfuscate_id Summary
obfuscate_id turns a URL like this:. Sequential ActiveRecord ids become non-sequential, random looking, numeric ids.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of obfuscate_id
obfuscate_id Key Features
obfuscate_id Examples and Code Snippets
Community Discussions
Trending Discussions on obfuscate_id
QUESTION
I'm trying to obfuscate the ids in several models.
I accomplish this using the solution proposed in this GitHub issue and is working fine (I don't want to use a gem
due the future compatibility problems).
The problem is that ids generated are small. I want them to start over the 1000000. How can accomplish this in a correct way?
The code for the model:
...ANSWER
Answered 2017-Jul-23 at 05:29The reason why the id is small is because the UUID string is being converted into an integer. Use SecureRandom.random_number(100000000000)
instead.
You need to check if the number is bigger than 1000000 and not already in the system.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install obfuscate_id
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page