[Mono-devel-list] Byte order issues in corlib
bernard at ugsolutions.com
Mon Apr 5 16:39:21 EDT 2004
I have discovered a bunch of byte order issues in corlib - particularly
in the Crypto stuff and was wondering on the best way to organize
code to fix them. The issue is BitConverter is platform endian (the
documentation is vague on this but given it contains the IsLittleEndian
property is presumably supposed to be this way).
An option I have tried is add a Mono.Security.BitConverterLE class
as an internal class which always works as little endian and use that
for the cases that matter. This seems to work.
It is capable for more general use but currently seems to only be needed
in this part of corlib. It could be somewhere else in namespaces too if
required - but I am not sure where?
One particular class - CryptoConvert.cs is copied into mcs as well
so that can't use an internal corlib class. For that I'd suggest just
having two methods in it to do the little endian conversion itself (only
needs ToInt32 and ToUInt32 in little endian versions).
Any comments or alternative suggestions?
More information about the Mono-devel-list