sysrandom 1.0.1-java → 1.0.2-java

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 53ffc040ccb76967f1491be3cb8c5045a4614514
4
- data.tar.gz: e27d25c036fd48d81aafe909c3b35a00a32b6d9d
3
+ metadata.gz: de6a4f367fd32e3e7c2c64a57b22d0809869d15d
4
+ data.tar.gz: 5d09e581a15ed0af0d9ed6d10466e5b469eedf3b
5
5
  SHA512:
6
- metadata.gz: f42b9b60f93187eb9c592c11a6e477cb901849659a73d3d1724b3d0ea4703b8fb926754d3322d5b278a7ad41fad46ee811ff71f8a0207e8665a0f724faddcf60
7
- data.tar.gz: 3755c3e7ad2e043519e2e36e0096d71c60c8023fd0772d5169312c9d6db27e994233cc56fbae3d1a968afbca97c16a70c789304ab6a576a0dd36cd072b40b8c8
6
+ metadata.gz: fd2a08738476a0782872c8f354f8c6727efdef3926437fc75578c6a9a4ac129490b367a5e31b0a5182a920e755663146f3cbf5243d0ca568747e48a980de01b3
7
+ data.tar.gz: 4bdc9edb6cb44b4829747b22e3fd6f6315ccd5d1df10379ee3ed4c482a5ad0ffa50ff98c30684f7e7fb52b674a0fdd1cc0290cfefafca9d6c80c26c5135e493b
data/CHANGES.md CHANGED
@@ -1,3 +1,13 @@
1
+ ## 1.0.2 (2016-06-06)
2
+
3
+ * [#12](https://github.com/cryptosphere/sysrandom/pull/12)
4
+ Remove unnecessary SecureRandom reference in 'hex' method.
5
+ ([@tarcieri])
6
+
7
+ * [#6](https://github.com/cryptosphere/sysrandom/pull/6)
8
+ Raise ArgumentError if 0 random bytes are requested (new minimum is 1).
9
+ ([@azet])
10
+
1
11
  ## 1.0.1 (2016-05-29)
2
12
 
3
13
  * [#11](https://github.com/cryptosphere/sysrandom/pull/11)
@@ -16,3 +26,4 @@
16
26
 
17
27
  [@tarcieri]: https://github.com/tarcieri
18
28
  [@coda]: https://github.com/coda
29
+ [@azet]: https://github.com/azet
@@ -70,7 +70,7 @@ Sysrandom_random_bytes(int argc, VALUE * argv, VALUE self)
70
70
  str = rb_str_new(0, n);
71
71
  __randombytes_sysrandom_buf(RSTRING_PTR(str), n);
72
72
  } else {
73
- str = rb_str_new2("");
73
+ rb_raise(rb_eArgError, "string size is zero");
74
74
  }
75
75
 
76
76
  return str;
data/lib/sysrandom.rb CHANGED
@@ -28,6 +28,7 @@ module Sysrandom
28
28
 
29
29
  def random_bytes(n = DEFAULT_LENGTH)
30
30
  raise ArgumentError, "negative string size" if n < 0
31
+ raise ArgumentError, "string size is zero" if n == 0
31
32
 
32
33
  bytes = Java::byte[n].new
33
34
  @_java_secure_random.nextBytes(bytes)
@@ -61,7 +62,7 @@ module Sysrandom
61
62
  end
62
63
 
63
64
  def uuid
64
- values = SecureRandom.hex(16).match(/\A(.{8})(.{4})(.)(.{3})(.)(.{3})(.{12})\z/)
65
+ values = hex(16).match(/\A(.{8})(.{4})(.)(.{3})(.)(.{3})(.{12})\z/)
65
66
  "#{values[1]}-#{values[2]}-4#{values[4]}-#{'89ab'[values[5].ord % 4]}#{values[6]}-#{values[7]}"
66
67
  end
67
68
  end
@@ -1,3 +1,3 @@
1
1
  module Sysrandom
2
- VERSION = "1.0.1".freeze
2
+ VERSION = "1.0.2".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sysrandom
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: java
6
6
  authors:
7
7
  - Tony Arcieri
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-05-30 00:00:00.000000000 Z
11
+ date: 2016-09-13 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Sysrandom generates secure random numbers using /dev/urandom, getrandom(), etc
14
14
  email: