Add default Sodium::Pwhash algorithm.

master
Didactic Drunk 2019-08-24 14:15:37 -07:00
parent ac15f86705
commit 2dda619026
3 changed files with 8 additions and 0 deletions

View File

@ -36,6 +36,7 @@ module Sodium
fun crypto_pwhash_saltbytes : LibC::SizeT
fun crypto_pwhash_bytes_min : LibC::SizeT
fun crypto_pwhash_bytes_max : LibC::SizeT
fun crypto_pwhash_alg_default : LibC::Int
fun crypto_generichash_blake2b_statebytes : LibC::SizeT
fun crypto_generichash_blake2b_bytes : LibC::SizeT
fun crypto_generichash_blake2b_bytes_min : LibC::SizeT

View File

@ -29,6 +29,11 @@ module Sodium
enum Mode
Argon2i13 = 1
Argon2id13 = 2
# The current libsodium default algorithm that may change between versions.
def default
Mode.new LibSodium.crypto_pwhash_alg_default
end
end
property opslimit = OPSLIMIT_INTERACTIVE

View File

@ -82,10 +82,12 @@ module Sodium
self
end
# Timing safe memory compare.
def ==(other : self)
Sodium.memcmp self.to_slice, other.to_slice
end
# Timing safe memory compare.
def ==(other : Bytes)
Sodium.memcmp self.to_slice, other
end