botan icon indicating copy to clipboard operation
botan copied to clipboard

Build a helper for "binary string formatting"

Open reneme opened this issue 1 year ago • 0 comments

I think what I want for things like this is some kind of "binary format string" eg

const auto prefix = format_binary("%u16be %u8bytes %u8", length, label, hash_val);

(not exactly this, those format string choices suck and are just for exposition; there is probably a lot of prior art here)

As of recently, we have the internal concat() helper for this which should already do such "binary string operations" as efficiently as possible. But the resulting code is often verbose (with multiple type conversions) and hard to understand.

Originally posted by @randombit in https://github.com/randombit/botan/pull/4455#discussion_r1900399502

reneme avatar Jan 10 '25 07:01 reneme