Sodium::Cipher::Aead::XChaCha20Poly1305IetfL: Add #nonce_size

This commit is contained in:
Didactic Drunk 2021-06-26 17:27:16 -07:00
parent 910666bcdf
commit b90d9bf117

View File

@ -78,8 +78,9 @@ module Sodium::Cipher::Aead
abstract def encrypt_detached(src : Bytes, dst : Bytes? = nil, *, nonce : Sodium::Nonce? = nil, mac : Bytes? = nil, additional : String | Bytes | Nil = nil) : {Bytes, Bytes, Sodium::Nonce} abstract def encrypt_detached(src : Bytes, dst : Bytes? = nil, *, nonce : Sodium::Nonce? = nil, mac : Bytes? = nil, additional : String | Bytes | Nil = nil) : {Bytes, Bytes, Sodium::Nonce}
abstract def decrypt_detached(src : Bytes, dst : Bytes? = nil, *, nonce : Sodium::Nonce, mac : Bytes, additional : String | Bytes | Nil = nil) : Bytes abstract def decrypt_detached(src : Bytes, dst : Bytes? = nil, *, nonce : Sodium::Nonce, mac : Bytes, additional : String | Bytes | Nil = nil) : Bytes
protected abstract def key_size : Int32 abstract def key_size : Int32
protected abstract def mac_size : Int32 abstract def mac_size : Int32
abstract def nonce_size : Int32
def dup def dup
self.class.new @key.dup self.class.new @key.dup
@ -143,13 +144,17 @@ module Sodium::Cipher::Aead
dst dst
end end
protected def key_size : Int32 def key_size : Int32
KEY_SIZE KEY_SIZE
end end
protected def mac_size : Int32 def mac_size : Int32
MAC_SIZE MAC_SIZE
end end
def nonce_size : Int32
NONCE_SIZE
end
end end
{% end %} {% end %}
end end