ffi-libsodium 0.2.6 → 0.2.7

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/sodium.rb +11 -0
  3. data/lib/sodium/version.rb +1 -1
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2e6e1510ebcfd34a4dd4dc8aa56cd6b670a4a954
4
- data.tar.gz: 011c860257aa7e3c7e2317a8004af503fafd0011
3
+ metadata.gz: 95e3d3e55b58d22b7d16193380dd64acf5b53795
4
+ data.tar.gz: 75cacb7cf5499370e9e87b591450312c831f3748
5
5
  SHA512:
6
- metadata.gz: 949283ba864307aae5c029a0808e1d5c29e2749b7ecb2067138467e7c7cc4daad95d97c9e83cd7297fd7bb8b02c0bc9b335dee22d50f56a7bf56aabecfe4350c
7
- data.tar.gz: cc94b8afde6ecee00a857392faa8b060e2c32b361ac76a7f4856f4f00cef3c29d6ca32866efbdc2315243c168c167bff655731328d37654550c6144024e7a8db
6
+ metadata.gz: 27dacc84385dff1c3c7759165a2e7ffd5fa9b440866088d3425318918aaff09ce6afd3433ce5ed481dfd798df7fa5a307b7833b738402b89d0c03bc8aa8d4960
7
+ data.tar.gz: e1877366d0aa2ec42624c55ff64e5bf10a3ec951245577658b72e3842ae46b511477d8e8e3ddce904bfe0b38090ed9c4111412befa78300d18dc1ebc3ac9edc6
data/lib/sodium.rb CHANGED
@@ -71,4 +71,15 @@ module Sodium
71
71
  raise LengthError, "bin_maxlen=#{bin_maxlen} is too short", caller
72
72
  end
73
73
  end
74
+
75
+ def hex2bin_in_place(hex, bin_maxlen, ignore = nil)
76
+ bin_len = FFI::MemoryPointer.new(:size_t)
77
+ if sodium_hex2bin(hex, bin_maxlen, hex, hex.bytesize, ignore, bin_len, nil) == 0
78
+ size = bin_len.size == 8 ? bin_len.read_uint64 : bin_len.read_uint32
79
+ hex.slice!(size..-1)
80
+ hex
81
+ else
82
+ raise LengthError, "bin_maxlen=#{bin_maxlen} is too short", caller
83
+ end
84
+ end
74
85
  end
@@ -1,3 +1,3 @@
1
1
  module Sodium
2
- VERSION = Gem::Version.new('0.2.6')
2
+ VERSION = Gem::Version.new('0.2.7')
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.6
4
+ version: 0.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hendrik Beskow