From d74de21b614804624f62f7fdbdeeb3b7faa734c7 Mon Sep 17 00:00:00 2001 From: davvd Date: Thu, 7 Dec 2023 08:24:40 +0500 Subject: [PATCH] #827 securerandom --- lib/zold/id.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/zold/id.rb b/lib/zold/id.rb index 7b2c334b..ea10a3ba 100644 --- a/lib/zold/id.rb +++ b/lib/zold/id.rb @@ -21,6 +21,7 @@ # SOFTWARE. require 'csv' +require 'securerandom' # The ID of the wallet. # Author:: Yegor Bugayenko (yegor256@gmail.com) @@ -38,7 +39,7 @@ class Id def self.generate_id loop do - id = format('%016x', rand((2**32)..(2**64) - 1)) + id = SecureRandom.hex(8) next if Id::BANNED.include?(id) return id end