-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4894 from ysbaddaden/std-merge-secure-random-into…
…-random Merge SecureRandom into Random and Random::Secure - Renames Random::System to Random::Secure. - Removes SecureRandom. - Moves #uuid, #hex and #base64 methods to Random. - Moves SecureRandom#random_bytes(slice) to Random::Secure. - Implements generic Random#random_bytes(slice).
- Loading branch information
Showing
19 changed files
with
253 additions
and
232 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
require "spec" | ||
require "random/secure" | ||
|
||
describe "Random::Secure" do | ||
it "returns random number from a secure system source" do | ||
Random::Secure.next_u.should be_a(Int::Unsigned) | ||
|
||
x = Random::Secure.rand(123456...654321) | ||
x.should be >= 123456 | ||
x.should be < 654321 | ||
|
||
Random::Secure.rand(Int64::MAX / 2).should be <= (Int64::MAX / 2) | ||
end | ||
|
||
it "fully fills a large buffer" do | ||
# mostly testing the linux getrandom calls | ||
bytes = Random::Secure.random_bytes(10000) | ||
bytes[9990, 10].should_not eq(Bytes.new(10)) | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
require "secure_random" | ||
|
||
module HTTP::Multipart | ||
# Builds a multipart MIME message. | ||
# | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
require "http/client" | ||
require "http/params" | ||
require "uri" | ||
require "secure_random" | ||
require "random/secure" | ||
require "openssl/hmac" | ||
require "base64" | ||
require "./oauth/**" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.