Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 560 Vote(s) - 3.49 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to generate a random string in Ruby

#51
The following worked well for me




def generate_random_password(min_length, max_length)
length = SecureRandom.random_number(max_length - min_length) + min_length
character_sets = [
('a'..'z').to_a,
('A'..'Z').to_a,
('0'..'9').to_a,
"~!@^&*()_-+=[]|:;<,>.?".split('')
]
retval = []
#
# Add one character from each set
#
character_sets.each do |character_set|
character = character_set[SecureRandom.random_number(character_set.count)]
retval.push character
end
#
# Fill the rest of the password with a random character from a random set
#
i = character_sets.count - 1
while i < length
character_set = character_sets[SecureRandom.random_number(character_sets.count)]
character = character_set[SecureRandom.random_number(character_set.count)]
retval.push character
i += 1
end
retval.shuffle.join
end
Reply

#52
For devise secure_validatable you can use this

```ruby
(0...8).map { ([65, 97].sample + rand(26)).chr }.push(rand(99)).join
```
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through