From 04c00bc7c9b8a92514a7390d2a315c4538ccc689 Mon Sep 17 00:00:00 2001 From: Victor Lopez Date: Wed, 4 Nov 2020 15:38:33 +0100 Subject: [PATCH] Re-add serialized size const fn for cipher --- src/cipher/cipher.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/cipher/cipher.rs b/src/cipher/cipher.rs index 742ae7c..9ec9f5b 100644 --- a/src/cipher/cipher.rs +++ b/src/cipher/cipher.rs @@ -12,7 +12,9 @@ use dusk_plonk::jubjub::AffinePoint; use dusk_plonk::prelude::*; use hades252::{ScalarStrategy, Strategy, WIDTH}; -use super::{CIPHER_BYTES_SIZE, CIPHER_SIZE, MESSAGE_CAPACITY}; +use super::{ + CIPHER_BYTES_SIZE, CIPHER_SIZE, ENCRYPTED_DATA_SIZE, MESSAGE_CAPACITY, +}; pub use super::CipherError; @@ -143,6 +145,11 @@ impl PoseidonCipher { MESSAGE_CAPACITY } + /// Bytes consumed on serialization of the poseidon cipher + pub const fn serialized_size() -> usize { + ENCRYPTED_DATA_SIZE + } + /// Encrypt a slice of scalars into an internal cipher representation /// /// The message size will be truncated to [`MESSAGE_CAPACITY`] bits