So I am implementing a cryptography algorithm now.
And I need to convert data to bytes and then split it in 64 bits. I do it by using BitConverter.
But sometimes I don't have 8 bytes in the end of a message and I wonder how to convert less than 8 bytes to ulong.
Is there any way to do it using BitConverter? I tried shifting the bytes but it's too complicated since I don't know the exact amount of bytes.
Fill the byte array with 0s until it fits the size required.
Reference: