Adds Redmine::Utils.random_hex for generating a random hex string.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9071 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2012-03-04 11:05:02 +00:00
parent 8db9ffbd8b
commit af75583b23
5 changed files with 12 additions and 5 deletions
+7
View File
@@ -33,6 +33,13 @@ module Redmine
ActionController::AbstractRequest.relative_url_root=arg
end
end
# Generates a n bytes random hex string
# Example:
# random_hex(4) # => "89b8c729"
def random_hex(n)
ActiveSupport::SecureRandom.hex(n)
end
end
end
end