Binary operators for bytes

Not sure where to put this, but I’ve recently been lacking binary operators for bytes.
I’m doing some “stuff” where I need to perform binary ops (and/or/not/xor) on the result of hashed data, but these ops exist only for ints and nats for some reason.

Also, another binary op, that would be very useful (I can write it myself but it involves annoying loops) would be bitcount, ie, counting how many bits are true.

If these are added to michelson it opens up a slew of interesting algorithms that can be realized.

Hi veqtor,

These shouldn’t be too hard to add. But first, let’s make sure you listed all the operators you are interested in and that the semantics is well defined.

Also it’ll be helpful to understand a bit more the context in which they would be used.

I suppose you want bitwise and/or/not/xor. But for binary operators what happens if the two operands don’t have the same size?

I intend to use this for various generative, programmatic and other tricks in combination with hashing functions to generate NFTs.

I would really like to refrain from going into more detail to keep our idea secret.

As for mismatched length, I would say that should lead to a failure.
If a developer instead wants to pad, they could concatenate bytes with whatever padding value they require.