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 +4 -4
- data/lib/blake2b/version.rb +1 -1
- data/lib/blake2b.rb +1 -0
- data/src/lib.rs +10 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 345d3116959340691b810f53d15e23dd9f9be63d17d38cf7f6b0a5ed7f0847d0
|
4
|
+
data.tar.gz: 314c59c0fcbef1b3ff1a28cf7dd0116576d19a53246697689503a81271520729
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eaffbec7170faf8f67f110d38d1309dbf812209091865cccf44e91f3a97f45458ffa2e0332d56c2a1490b98db65c34b7264375e371d08c6898c6598a71357ea7
|
7
|
+
data.tar.gz: cee136926dfbfc0bb5cdbcb91ccc18e8afce494aa302206e17732249e9bfa34a11b35167dc73416092aac1df84282ea950786982b8a28ec46e0e1c11e781ecb7
|
data/lib/blake2b/version.rb
CHANGED
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.
|
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:
|
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.
|
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
|