ffi-libsodium 0.2.5 → 0.2.6

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: 098cc9a2b79fd39389f77241c75bc2e03efb0461
4
- data.tar.gz: e1ae4db97427751f2eb56d9081c30a3a7791604b
3
+ metadata.gz: 2e6e1510ebcfd34a4dd4dc8aa56cd6b670a4a954
4
+ data.tar.gz: 011c860257aa7e3c7e2317a8004af503fafd0011
5
5
  SHA512:
6
- metadata.gz: be3aa678237413491b999b89dc66d93a4567fed6a01be67e197844f92e4aa9dc4e3a58dc506eac54731ab117ca5501e04caa665332902477531e3fb6a097195a
7
- data.tar.gz: 15f1532694c26a4b2ec4bd04c64c25805e1f9c9a9d688aee75b1ac92142876a7ab4cd8bbd483a869375b36eda66429e82f3e680e5f663df752a60625283a7a75
6
+ metadata.gz: 949283ba864307aae5c029a0808e1d5c29e2749b7ecb2067138467e7c7cc4daad95d97c9e83cd7297fd7bb8b02c0bc9b335dee22d50f56a7bf56aabecfe4350c
7
+ data.tar.gz: cc94b8afde6ecee00a857392faa8b060e2c32b361ac76a7f4856f4f00cef3c29d6ca32866efbdc2315243c168c167bff655731328d37654550c6144024e7a8db
data/lib/sodium.rb CHANGED
@@ -63,8 +63,10 @@ module Sodium
63
63
 
64
64
  def hex2bin(hex, bin_maxlen, ignore = nil)
65
65
  bin = Sodium::Buffer.new(:uchar, bin_maxlen)
66
- if sodium_hex2bin(bin, bin_maxlen, hex, hex.bytesize, ignore, nil, nil) == 0
67
- bin
66
+ bin_len = FFI::MemoryPointer.new(:size_t)
67
+ if sodium_hex2bin(bin, bin_maxlen, hex, hex.bytesize, ignore, bin_len, nil) == 0
68
+ size = bin_len.size == 8 ? bin_len.read_uint64 : bin_len.read_uint32
69
+ [bin, size]
68
70
  else
69
71
  raise LengthError, "bin_maxlen=#{bin_maxlen} is too short", caller
70
72
  end
@@ -1,3 +1,3 @@
1
1
  module Sodium
2
- VERSION = Gem::Version.new('0.2.5')
2
+ VERSION = Gem::Version.new('0.2.6')
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ffi-libsodium
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hendrik Beskow