Граф коммитов

13 Коммитов

Автор SHA1 Сообщение Дата
Jeremy Evans 5fef46ae0d Test SecureRandom.uuid format
SecureRandom uses v4 UUIDs, which are completely random except for
6 bits, 4 in the version field and 2 in the clk_seq_hi_res field.
Add a test that those bit patterns are set correctly for v4 UUIDs,
per RFC 4122 section 4.4.

Fixes [Bug #13603]
2019-07-26 09:56:53 -07:00
Urabe, Shyouhei 5bab1304af fix visibility of SecureRandom.gen_random
Aliasing a method preserves its visibility.  These aliases turn
formerly-public methods into private.  Should make them public
again.  [Bug #15847]
2019-05-14 11:44:20 +09:00
kazu dfee14d34c Use `\A` and `\z` instead of `^` and `$`
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60358 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-22 09:16:54 +00:00
akr 6cba29b422 less random generations in Random::Formatter#choose.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60309 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 16:12:46 +00:00
akr b867882a1c SecureRandom.alphanumeric implemented.
[ruby-core:68098] [Feature #10849] proposed by Andrew Butterfield.

SecureRandom.choose and SecureRandom.graph is not included.
(The implementation has SecureRandom.choose but it is private.)

I feel the method name, SecureRandom.choose, doesn't represent
the behavior well.

The actual use cases of SecureRandom.graph is not obvious.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60297 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 15:21:26 +00:00
mame 782b2050b8 Update a test of SecureRandom according to r57384
SecureRandom uses urandom by default.  So the test for a case where
openssl is unavailable makes no sense.  Instead, a simple test for a
case where urandom is unavailable is added.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59801 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-09 15:12:10 +00:00
nobu b402cc7161 random.c: use bytes
* random.c (obj_random_bytes): base on bytes method instead of
  rand method, not to call toplevel rand method.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54968 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-10 05:57:11 +00:00
naruse 3e92b635fb Add frozen_string_literal: false for all files
When you change this to true, you may need to add more tests.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-16 05:07:31 +00:00
nobu 2c3656f5e8 test: refine assertions
* test/test_prime.rb (test_eratosthenes_works_fine_after_timeout):
  use assert_raise to check timeout.

* test/test_securerandom.rb: check if results are hexadecimal
  strings, and refine failure messages.

* test/test_tracer.rb (test_tracer_with_option_r_without_gems):
  use assert_equal to compare.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51023 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-25 05:26:31 +00:00
hsbt 3efb36c25c * test/test_securerandom.rb: use File.exist? instead of File.exists?
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45000 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-16 06:55:06 +00:00
eregon b0e40509c3 set encoding to ASCII for appropriate String#unpack modifiers
* pack.c (pack_unpack): set encoding of the
  'H','h','B' and 'B' modifiers to US-ASCII.
* test/ruby/test_pack.rb: tests for the above.
  [ruby-core:47653][Bug #7050]
* test/test_securerandom.rb: tests for SecureRandom.hex
  from tenderlove. [ruby-core:46792][Bug #6799]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37269 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-19 13:13:32 +00:00
naruse 131f694330 Suppress warnings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36534 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-25 06:49:35 +00:00
nahi a15dfa6b4a * test/test_securerandom.rb: Add testcase. This testcase does NOT aim
to test cryptographically strongness and randomness.  It includes 
  the test for PID recycle issue of OpenSSL described in #4579 but 
  it's disabled by default.  


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32122 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-16 10:32:51 +00:00