blake2b_rs 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4199b51da84bc1de3ef6ddaddfb4e445e4f7e8896d8cfcc9b5cc003a8aad58b3
4
- data.tar.gz: a20b784512be31c7764f624abddae180f878c7d438cf06128fac6c88cf80d1c4
3
+ metadata.gz: 345d3116959340691b810f53d15e23dd9f9be63d17d38cf7f6b0a5ed7f0847d0
4
+ data.tar.gz: 314c59c0fcbef1b3ff1a28cf7dd0116576d19a53246697689503a81271520729
5
5
  SHA512:
6
- metadata.gz: '0883983d980a7ea240f9e19970e73a0dc415105b3fddeaa01b52dfffe3ab7b6225c9191bbfe8b7b1c26be8d14bdcc644880f135c695149dfff9602b0d2fd0755'
7
- data.tar.gz: 487454545630977cd7c61190f436a0a9698767014cd4462314576dc61e8dbf1e47eb9d041790fff5bd680b237f007795cf7103228f0a2b6cbf548ab872590204
6
+ metadata.gz: eaffbec7170faf8f67f110d38d1309dbf812209091865cccf44e91f3a97f45458ffa2e0332d56c2a1490b98db65c34b7264375e371d08c6898c6598a71357ea7
7
+ data.tar.gz: cee136926dfbfc0bb5cdbcb91ccc18e8afce494aa302206e17732249e9bfa34a11b35167dc73416092aac1df84282ea950786982b8a28ec46e0e1c11e781ecb7
@@ -1,3 +1,3 @@
1
1
  module Blake2b
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
data/lib/blake2b.rb CHANGED
@@ -17,6 +17,7 @@ module Blake2b
17
17
  extend FFI::Library
18
18
  ffi_lib "#{__dir__}/../target/release/libblake2b." + FFI::Platform::LIBSUFFIX
19
19
  attach_function :rust_blake2b, %i[pointer int int], Str
20
+ attach_function :free, :free_s, [Str], :void
20
21
 
21
22
  def self.hex(u8a, out_len=32)
22
23
  c = FFI::MemoryPointer.new(:int8, u8a.size)
data/src/lib.rs CHANGED
@@ -12,6 +12,16 @@ fn to_u8_vec(pointer: *const u8, len: usize) -> Vec<u8> {
12
12
  data_slice.to_vec()
13
13
  }
14
14
 
15
+ #[no_mangle]
16
+ pub extern "C" fn free_s(s: *mut c_char) {
17
+ unsafe {
18
+ if s.is_null() {
19
+ return;
20
+ }
21
+ CString::from_raw(s)
22
+ };
23
+ }
24
+
15
25
  #[no_mangle]
16
26
  pub extern fn rust_blake2b(p: *const u8, len: usize, out_len: usize) -> *mut c_char{
17
27
  let data = to_u8_vec(p, len);
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blake2b_rs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aki Wu
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-10-26 00:00:00.000000000 Z
11
+ date: 2022-12-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thermite
@@ -85,7 +85,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
85
85
  - !ruby/object:Gem::Version
86
86
  version: '0'
87
87
  requirements: []
88
- rubygems_version: 3.1.4
88
+ rubygems_version: 3.3.7
89
89
  signing_key:
90
90
  specification_version: 4
91
91
  summary: A ruby blake2b gem which using rust blake2 crate