securerandom 0.3.1 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/{LICENSE.txt → BSDL} +3 -3
- data/COPYING +56 -0
- data/lib/random/formatter.rb +8 -9
- data/lib/securerandom.rb +1 -1
- metadata +8 -18
- data/.document +0 -4
- data/.github/dependabot.yml +0 -6
- data/.github/workflows/test.yml +0 -29
- data/.gitignore +0 -8
- data/Gemfile +0 -4
- data/Rakefile +0 -10
- data/bin/console +0 -14
- data/bin/setup +0 -8
- data/docs/random.rb +0 -10
- data/rakelib/epoch.rake +0 -5
- data/securerandom.gemspec +0 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6f14853630e9280f98e432e1da48fd1eb894a7376c4e3678dc97639e28929c3d
|
4
|
+
data.tar.gz: 79846163a70d7b0198271a61ce63a7320c9a141dd59d0912a91e9a5259353999
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d448c439592c67f07e543c855fa4c06e6da72ce84d31ade33ea97d76d5ee90952b575c938a34bf8e11453353920582d0d5311cf9212b6ba7397fa3d038bc2e5
|
7
|
+
data.tar.gz: c3080d88c1a11a88ca3a28ddc6e173ab5afbf6027d60c353263ed9f78b8982a55dcc15c4a88cc3f2a44ba6e8a5933d7283af91b2f38965f67ebd68e636d78922
|
data/{LICENSE.txt → BSDL}
RENAMED
@@ -4,10 +4,10 @@ Redistribution and use in source and binary forms, with or without
|
|
4
4
|
modification, are permitted provided that the following conditions
|
5
5
|
are met:
|
6
6
|
1. Redistributions of source code must retain the above copyright
|
7
|
-
notice, this list of conditions and the following disclaimer.
|
7
|
+
notice, this list of conditions and the following disclaimer.
|
8
8
|
2. Redistributions in binary form must reproduce the above copyright
|
9
|
-
notice, this list of conditions and the following disclaimer in the
|
10
|
-
documentation and/or other materials provided with the distribution.
|
9
|
+
notice, this list of conditions and the following disclaimer in the
|
10
|
+
documentation and/or other materials provided with the distribution.
|
11
11
|
|
12
12
|
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
13
13
|
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
data/COPYING
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
Ruby is copyrighted free software by Yukihiro Matsumoto <matz@netlab.jp>.
|
2
|
+
You can redistribute it and/or modify it under either the terms of the
|
3
|
+
2-clause BSDL (see the file BSDL), or the conditions below:
|
4
|
+
|
5
|
+
1. You may make and give away verbatim copies of the source form of the
|
6
|
+
software without restriction, provided that you duplicate all of the
|
7
|
+
original copyright notices and associated disclaimers.
|
8
|
+
|
9
|
+
2. You may modify your copy of the software in any way, provided that
|
10
|
+
you do at least ONE of the following:
|
11
|
+
|
12
|
+
a. place your modifications in the Public Domain or otherwise
|
13
|
+
make them Freely Available, such as by posting said
|
14
|
+
modifications to Usenet or an equivalent medium, or by allowing
|
15
|
+
the author to include your modifications in the software.
|
16
|
+
|
17
|
+
b. use the modified software only within your corporation or
|
18
|
+
organization.
|
19
|
+
|
20
|
+
c. give non-standard binaries non-standard names, with
|
21
|
+
instructions on where to get the original software distribution.
|
22
|
+
|
23
|
+
d. make other distribution arrangements with the author.
|
24
|
+
|
25
|
+
3. You may distribute the software in object code or binary form,
|
26
|
+
provided that you do at least ONE of the following:
|
27
|
+
|
28
|
+
a. distribute the binaries and library files of the software,
|
29
|
+
together with instructions (in the manual page or equivalent)
|
30
|
+
on where to get the original distribution.
|
31
|
+
|
32
|
+
b. accompany the distribution with the machine-readable source of
|
33
|
+
the software.
|
34
|
+
|
35
|
+
c. give non-standard binaries non-standard names, with
|
36
|
+
instructions on where to get the original software distribution.
|
37
|
+
|
38
|
+
d. make other distribution arrangements with the author.
|
39
|
+
|
40
|
+
4. You may modify and include the part of the software into any other
|
41
|
+
software (possibly commercial). But some files in the distribution
|
42
|
+
are not written by the author, so that they are not under these terms.
|
43
|
+
|
44
|
+
For the list of those files and their copying conditions, see the
|
45
|
+
file LEGAL.
|
46
|
+
|
47
|
+
5. The scripts and library files supplied as input to or produced as
|
48
|
+
output from the software do not automatically fall under the
|
49
|
+
copyright of the software, but belong to whomever generated them,
|
50
|
+
and may be sold commercially, and may be aggregated with this
|
51
|
+
software.
|
52
|
+
|
53
|
+
6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
|
54
|
+
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
55
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
56
|
+
PURPOSE.
|
data/lib/random/formatter.rb
CHANGED
@@ -165,13 +165,13 @@ module Random::Formatter
|
|
165
165
|
#
|
166
166
|
# The result contains 122 random bits (15.25 random bytes).
|
167
167
|
#
|
168
|
-
# See
|
168
|
+
# See RFC9562[https://www.rfc-editor.org/rfc/rfc9562] for details of UUIDv4.
|
169
169
|
#
|
170
170
|
def uuid
|
171
|
-
ary = random_bytes(16)
|
172
|
-
ary
|
173
|
-
ary
|
174
|
-
"
|
171
|
+
ary = random_bytes(16)
|
172
|
+
ary.setbyte(6, (ary.getbyte(6) & 0x0f) | 0x40)
|
173
|
+
ary.setbyte(8, (ary.getbyte(8) & 0x3f) | 0x80)
|
174
|
+
ary.unpack("H8H4H4H4H12").join(?-)
|
175
175
|
end
|
176
176
|
|
177
177
|
alias uuid_v4 uuid
|
@@ -201,11 +201,10 @@ module Random::Formatter
|
|
201
201
|
#
|
202
202
|
# The result contains 74 random bits (9.25 random bytes).
|
203
203
|
#
|
204
|
-
# Note that this method cannot be made
|
204
|
+
# Note that this method cannot be made reproducible because its output
|
205
205
|
# includes not only random bits but also timestamp.
|
206
206
|
#
|
207
|
-
# See
|
208
|
-
# for details of UUIDv7.
|
207
|
+
# See RFC9562[https://www.rfc-editor.org/rfc/rfc9562] for details of UUIDv7.
|
209
208
|
#
|
210
209
|
# ==== Monotonicity
|
211
210
|
#
|
@@ -242,7 +241,7 @@ module Random::Formatter
|
|
242
241
|
#
|
243
242
|
# Counters and other mechanisms for stronger guarantees of monotonicity are
|
244
243
|
# not implemented. Applications with stricter requirements should follow
|
245
|
-
# {Section 6.2}[https://www.
|
244
|
+
# {Section 6.2}[https://www.rfc-editor.org/rfc/rfc9562.html#name-monotonicity-and-counters]
|
246
245
|
# of the specification.
|
247
246
|
#
|
248
247
|
def uuid_v7(extra_timestamp_bits: 0)
|
data/lib/securerandom.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: securerandom
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tanaka Akira
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-11-11 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Interface for secure random number generator.
|
14
14
|
email:
|
@@ -17,21 +17,11 @@ executables: []
|
|
17
17
|
extensions: []
|
18
18
|
extra_rdoc_files: []
|
19
19
|
files:
|
20
|
-
-
|
21
|
-
-
|
22
|
-
- ".github/workflows/test.yml"
|
23
|
-
- ".gitignore"
|
24
|
-
- Gemfile
|
25
|
-
- LICENSE.txt
|
20
|
+
- BSDL
|
21
|
+
- COPYING
|
26
22
|
- README.md
|
27
|
-
- Rakefile
|
28
|
-
- bin/console
|
29
|
-
- bin/setup
|
30
|
-
- docs/random.rb
|
31
23
|
- lib/random/formatter.rb
|
32
24
|
- lib/securerandom.rb
|
33
|
-
- rakelib/epoch.rake
|
34
|
-
- securerandom.gemspec
|
35
25
|
homepage: https://github.com/ruby/securerandom
|
36
26
|
licenses:
|
37
27
|
- Ruby
|
@@ -39,7 +29,7 @@ licenses:
|
|
39
29
|
metadata:
|
40
30
|
homepage_uri: https://github.com/ruby/securerandom
|
41
31
|
source_code_uri: https://github.com/ruby/securerandom
|
42
|
-
post_install_message:
|
32
|
+
post_install_message:
|
43
33
|
rdoc_options: []
|
44
34
|
require_paths:
|
45
35
|
- lib
|
@@ -54,8 +44,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
54
44
|
- !ruby/object:Gem::Version
|
55
45
|
version: '0'
|
56
46
|
requirements: []
|
57
|
-
rubygems_version: 3.5.
|
58
|
-
signing_key:
|
47
|
+
rubygems_version: 3.5.11
|
48
|
+
signing_key:
|
59
49
|
specification_version: 4
|
60
50
|
summary: Interface for secure random number generator.
|
61
51
|
test_files: []
|
data/.document
DELETED
data/.github/dependabot.yml
DELETED
data/.github/workflows/test.yml
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
name: test
|
2
|
-
|
3
|
-
on: [push, pull_request]
|
4
|
-
|
5
|
-
jobs:
|
6
|
-
ruby-versions:
|
7
|
-
uses: ruby/actions/.github/workflows/ruby_versions.yml@master
|
8
|
-
with:
|
9
|
-
engine: cruby
|
10
|
-
min_version: 2.6
|
11
|
-
|
12
|
-
test:
|
13
|
-
needs: ruby-versions
|
14
|
-
name: build (${{ matrix.ruby }} / ${{ matrix.os }})
|
15
|
-
strategy:
|
16
|
-
matrix:
|
17
|
-
ruby: ${{ fromJson(needs.ruby-versions.outputs.versions) }}
|
18
|
-
os: [ ubuntu-latest, macos-latest, windows-latest ]
|
19
|
-
runs-on: ${{ matrix.os }}
|
20
|
-
steps:
|
21
|
-
- uses: actions/checkout@v4
|
22
|
-
- name: Set up Ruby
|
23
|
-
uses: ruby/setup-ruby@v1
|
24
|
-
with:
|
25
|
-
ruby-version: ${{ matrix.ruby }}
|
26
|
-
- name: Install dependencies
|
27
|
-
run: bundle install
|
28
|
-
- name: Run test
|
29
|
-
run: rake test
|
data/.gitignore
DELETED
data/Gemfile
DELETED
data/Rakefile
DELETED
data/bin/console
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "securerandom"
|
5
|
-
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
require "irb"
|
14
|
-
IRB.start(__FILE__)
|
data/bin/setup
DELETED
data/docs/random.rb
DELETED
data/rakelib/epoch.rake
DELETED
data/securerandom.gemspec
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
name = File.basename(__FILE__, ".gemspec")
|
2
|
-
version = ["lib", Array.new(name.count("-")+1).join("/")].find do |dir|
|
3
|
-
break File.foreach(File.join(__dir__, dir, "#{name.tr('-', '/')}.rb")) do |line|
|
4
|
-
/^\s*VERSION\s*=\s*"(.*)"/ =~ line and break $1
|
5
|
-
end rescue nil
|
6
|
-
end
|
7
|
-
|
8
|
-
Gem::Specification.new do |spec|
|
9
|
-
spec.name = name
|
10
|
-
spec.version = version
|
11
|
-
spec.authors = ["Tanaka Akira"]
|
12
|
-
spec.email = ["akr@fsij.org"]
|
13
|
-
|
14
|
-
spec.summary = %q{Interface for secure random number generator.}
|
15
|
-
spec.description = %q{Interface for secure random number generator.}
|
16
|
-
spec.homepage = "https://github.com/ruby/securerandom"
|
17
|
-
spec.required_ruby_version = Gem::Requirement.new(">= 2.6.0")
|
18
|
-
spec.licenses = ["Ruby", "BSD-2-Clause"]
|
19
|
-
|
20
|
-
spec.metadata["homepage_uri"] = spec.homepage
|
21
|
-
spec.metadata["source_code_uri"] = spec.homepage
|
22
|
-
|
23
|
-
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
24
|
-
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
25
|
-
end
|
26
|
-
spec.bindir = "exe"
|
27
|
-
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
28
|
-
spec.require_paths = ["lib"]
|
29
|
-
end
|