ffi-libsodium 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/crypto/pw_hash/scrypt_salsa208_sha256.rb +6 -6
- data/lib/sodium.rb +1 -1
- data/lib/sodium/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2d30d2756247274875e470ab61e090288114cb2d
|
4
|
+
data.tar.gz: 7d7edba752748cac108b93b446a2ce9e8a2ada35
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: abe3e18a46e2bd3a83fe093a56d6529df2ac856e4df9fc1521c46246bfd90ab6b3d6d6f8f3fcd000e6d4b6c1975e46eacd4acae3bd79b0cc46d11970002813c4
|
7
|
+
data.tar.gz: f6ebd40cd8971e20625ed634eca8d90129079a7f971d5d0c3c2d87e4c3ee206a546e397ba8934bf51291343970a1052ba1961e7c0026527547435db231c08234
|
@@ -38,9 +38,9 @@ module Crypto
|
|
38
38
|
OPSLIMIT_SENSITIVE = opslimit_sensitive.freeze
|
39
39
|
MEMLIMIT_SENSITIVE = memlimit_sensitive.freeze
|
40
40
|
|
41
|
-
attach_function :crypto_pwhash_scryptsalsa208sha256, [:buffer_out, :ulong_long, :
|
42
|
-
attach_function :crypto_pwhash_scryptsalsa208sha256_str, [:buffer_out, :
|
43
|
-
attach_function :crypto_pwhash_scryptsalsa208sha256_str_verify, [:string, :
|
41
|
+
attach_function :crypto_pwhash_scryptsalsa208sha256, [:buffer_out, :ulong_long, :string, :ulong_long, :buffer_in, :ulong_long, :size_t], :int
|
42
|
+
attach_function :crypto_pwhash_scryptsalsa208sha256_str, [:buffer_out, :string, :ulong_long, :ulong_long, :size_t], :int
|
43
|
+
attach_function :crypto_pwhash_scryptsalsa208sha256_str_verify, [:string, :string, :ulong_long], :int
|
44
44
|
|
45
45
|
module_function
|
46
46
|
|
@@ -52,7 +52,7 @@ module Crypto
|
|
52
52
|
check_length(salt, SALTBYTES, :Salt)
|
53
53
|
|
54
54
|
out = Sodium::SecretBuffer.new(outlen)
|
55
|
-
if crypto_pwhash_scryptsalsa208sha256(out, outlen, passwd,
|
55
|
+
if crypto_pwhash_scryptsalsa208sha256(out, outlen, passwd, passwd.bytesize, salt, opslimit, memlimit) == 0
|
56
56
|
out.noaccess
|
57
57
|
out
|
58
58
|
else
|
@@ -62,7 +62,7 @@ module Crypto
|
|
62
62
|
|
63
63
|
def str(passwd, opslimit = OPSLIMIT_INTERACTIVE, memlimit = MEMLIMIT_INTERACTIVE)
|
64
64
|
hashed_password = FFI::MemoryPointer.new(:char, STRBYTES)
|
65
|
-
if crypto_pwhash_scryptsalsa208sha256_str(hashed_password, passwd,
|
65
|
+
if crypto_pwhash_scryptsalsa208sha256_str(hashed_password, passwd, passwd.bytesize, opslimit, memlimit) == 0
|
66
66
|
hashed_password.get_string(0)
|
67
67
|
else
|
68
68
|
raise NoMemoryError, "Failed to allocate memory max size=#{memlimit} bytes", caller
|
@@ -71,7 +71,7 @@ module Crypto
|
|
71
71
|
|
72
72
|
def str_verify(str, passwd)
|
73
73
|
check_length(str, STRBYTES - 1, :Str)
|
74
|
-
crypto_pwhash_scryptsalsa208sha256_str_verify(str, passwd,
|
74
|
+
crypto_pwhash_scryptsalsa208sha256_str_verify(str, passwd, passwd.bytesize) == 0
|
75
75
|
end
|
76
76
|
end
|
77
77
|
|
data/lib/sodium.rb
CHANGED
@@ -19,7 +19,7 @@ module Sodium
|
|
19
19
|
attach_function :sodium_allocarray, [:size_t, :size_t], :pointer
|
20
20
|
|
21
21
|
attach_function :sodium_bin2hex, [:buffer_out, :size_t, :buffer_in, :size_t], :string
|
22
|
-
attach_function :sodium_hex2bin, [:buffer_out, :size_t, :
|
22
|
+
attach_function :sodium_hex2bin, [:buffer_out, :size_t, :string, :size_t, :string, :buffer_out, :pointer], :int
|
23
23
|
|
24
24
|
module_function
|
25
25
|
|
data/lib/sodium/version.rb
CHANGED