I had this

        {
        key0: OpenSSL::Digest::SHA256.new.digest("1 #{key}"),
      key1: OpenSSL::Digest::SHA256.new.digest("2 #{key}"),
      key2: OpenSSL::Digest::SHA256.new.digest("3 #{key}"),
      key3: OpenSSL::Digest::SHA256.new.digest("4 #{key}")
      }

I want this

subkeys = {}
4.times do |i|
subkeys[:key"#{i}"] = OpenSSL::Digest::SHA256.new.digest("#{i} #{key}")
end

-- 
Posted via http://www.ruby-forum.com/.