Allow reusable nonces.
parent
8ed9f94ead
commit
2d0ed351ea
|
@ -43,7 +43,7 @@ loop do
|
|||
|
||||
loop do
|
||||
# p pwhash
|
||||
t = Time.measure { pwhash.store pass }.to_f
|
||||
t = Time.measure { pwhash.create pass }.to_f
|
||||
ostr = "%7d" % pwhash.opslimit
|
||||
header << ostr if data.size == 2
|
||||
if t >= time_min
|
||||
|
|
|
@ -10,8 +10,10 @@ module Sodium
|
|||
|
||||
NONCE_SIZE = LibSodium::NONCE_SIZE.to_i
|
||||
|
||||
getter? used
|
||||
@used = false
|
||||
getter? used = false
|
||||
|
||||
# Only use with single use keys.
|
||||
property? reusable = false
|
||||
|
||||
# Returns bytes
|
||||
delegate to_slice, to: @bytes
|
||||
|
@ -37,7 +39,7 @@ module Sodium
|
|||
|
||||
def used!
|
||||
raise Error::Reused.new("attempted nonce reuse") if @used
|
||||
@used = true
|
||||
@used = true unless @reusable
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue