Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

purpose of wrapping RawCiphertext via EncodedCiphertext? #71

Open
haochenuw opened this issue Oct 14, 2020 · 1 comment
Open

purpose of wrapping RawCiphertext via EncodedCiphertext? #71

haochenuw opened this issue Oct 14, 2020 · 1 comment

Comments

@haochenuw
Copy link

More of a question than an issue, but I was wondering what's the purpose of using EncodedCiphertext type to wrap the RawCiphertext? Also quite new to rust -- could you give pointers to help understand the syntax below? I understand that the first line is implementing the Encrypt trait, but not sure what the second and third line means.

impl<EK> Encrypt<EK, u64, EncodedCiphertext<u64>> for Paillier
where
    for<'p, 'c> Self: Encrypt<EK, RawPlaintext<'p>, RawCiphertext<'c>>,
{
                 // more code here
        }
    }
}
@omershlo
Copy link
Collaborator

I personally never used the EncodedCiphertext added property over RawCiphertext (in fact when I handle ciphertexts I usually try to work with the BigInt itself).
However, in theory, the EncodedCiphertext adds another field to Rawciphertext that can be used for different purposes. In the code it is being used for "packing" which is common operation that allows to take several small messages and encrypt them together in a single ciphertext

About the code snippet: I suggest you ignore it for now. It is a way to express bounds: https://doc.rust-lang.org/stable/rust-by-example/generics/where.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants