rbsecp256k1 1.0.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,9 @@
1
1
  module Secp256k1
2
2
  # Contains utility methods that complement the functionality of the library.
3
3
  module Util
4
+ # Regexp to validate a hexadecimal string
5
+ HEX_REGEXP = /^[A-Fa-f\d]+$/.freeze
6
+
4
7
  # Converts a binary string to a hex string.
5
8
  #
6
9
  # @param binary_string [String] binary string to be converted.
@@ -13,7 +16,10 @@ module Secp256k1
13
16
  #
14
17
  # @param hex_string [String] string with hexadeimcal value.
15
18
  # @return [String] binary string equivalent of the given hex string.
19
+ # @raise [ArgumentError] if hex string is an invalid hexadecimal string.
16
20
  def self.hex_to_bin(hex_string)
21
+ raise ArgumentError, "Invalid hexadecimal string" unless hex_string =~ HEX_REGEXP
22
+
17
23
  [hex_string].pack('H*')
18
24
  end
19
25
  end
@@ -1,3 +1,3 @@
1
1
  module Secp256k1
2
- VERSION = '1.0.0'.freeze
2
+ VERSION = '2.0.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbsecp256k1
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Scrivner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-23 00:00:00.000000000 Z
11
+ date: 2019-01-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0.61'
69
+ - !ruby/object:Gem::Dependency
70
+ name: yard
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '0.9'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '0.9'
69
83
  description:
70
84
  email:
71
85
  executables: []