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

Bit-based serialization concatenation #161

Open
Pratyush opened this issue Dec 30, 2020 · 0 comments
Open

Bit-based serialization concatenation #161

Pratyush opened this issue Dec 30, 2020 · 0 comments

Comments

@Pratyush
Copy link
Member

Pratyush commented Dec 30, 2020

Currently flags are a special case for allowing appending up to 8 bits directly to an objects serialized data, starting from the final bit used by the objects serialization. At the moment this is written such that the object has to append these bits itself.

Perhaps we should instead make a general method for allowing concatenating the serialization of two objects at the bit boundary.

To do this, we would add a method to CanonicalSerialize for serialized_size_bits (which could even have an auto-impl to just be 8 * serialized_size), and then add a new type that has types A,B templated, and serializes them both, appended to one another at the bit-boundary.

I think such a method could simplify the flag logic, and allow for further space savings in applications that require it. (E.g. for serializing many 257 bit field elements). It may be that the computational overhead makes this more general method never worth it, but I'd be a bit surprised if that was the case. (Since the computational overhead may be dwarfed by the cryptography operations involved)

Originally posted by @ValarDragon in #160 (comment)

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

1 participant