summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-03-04 11:05:02 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-03-04 11:05:02 +0000
commitaf75583b23db2bc6848fa1131cf9f66f073c8549 (patch)
treef5667c3b633791122faaa9138c03ae52f34f3789 /lib
parent8db9ffbd8bda68a98ac5896dc0d5f3bfba4c7b70 (diff)
downloadredmine-af75583b23db2bc6848fa1131cf9f66f073c8549.tar.gz
redmine-af75583b23db2bc6848fa1131cf9f66f073c8549.zip
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
Diffstat (limited to 'lib')
-rw-r--r--lib/redmine/utils.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/redmine/utils.rb b/lib/redmine/utils.rb
index 593406eb1..96580168f 100644
--- a/lib/redmine/utils.rb
+++ b/lib/redmine/utils.rb
@@ -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