Skip to content
This repository has been archived by the owner on Mar 15, 2023. It is now read-only.

Does not recognize little-endian byte array representation #9

Closed
gimesia opened this issue Nov 20, 2020 · 2 comments · Fixed by #26
Closed

Does not recognize little-endian byte array representation #9

gimesia opened this issue Nov 20, 2020 · 2 comments · Fixed by #26
Assignees
Labels
bug Something isn't working enhancement New feature or request question Further information is requested

Comments

@gimesia
Copy link
Contributor

gimesia commented Nov 20, 2020

Guid V4's byte array representation has its first 4 bytes in little-endian order. Atm the class can't parse V4 guids from byte arrays that matches this rule.

Guid.ToByteArray method in C#:
https://docs.microsoft.com/en-us/dotnet/api/system.guid.tobytearray?view=net-5.0

@gimesia gimesia added bug Something isn't working question Further information is requested labels Nov 20, 2020
@bencelang
Copy link
Member

This is a very interesting difference in behavior between different stacks. C# seems to be handling GUIDs not simply as an array of bytes internally thus the diff in representation. On the other hand, Java has those bytes big-endian.

There are two major directions we could follow with a fix implementation for this issue:

  1. Have a globally configurable behavior of endianness (like the version handling currently). This comes with possible performance and complexity earnings on the cost of missing the features to support both at the same time.
  2. Have all methods involving byte array operations configurable endianness options and preferably a globally configurable default.

@bencelang bencelang added the enhancement New feature or request label Nov 30, 2020
@bencelang bencelang self-assigned this Nov 30, 2020
@gimesia
Copy link
Contributor Author

gimesia commented Nov 30, 2020

This is a very interesting difference in behavior between different stacks. C# seems to be handling GUIDs not simply as an array of bytes internally thus the diff in representation. On the other hand, Java has those bytes big-endian.

There are two major directions we could follow with a fix implementation for this issue:

  1. Have a globally configurable behavior of endianness (like the version handling currently). This comes with possible performance and complexity earnings on the cost of missing the features to support both at the same time.
  2. Have all methods involving byte array operations configurable endianness options and preferably a globally configurable default.

maybe we could have an optional little-endian bool parameter in isByteArray() function and each handler could call this function with different params...

image

@gimesia gimesia mentioned this issue Nov 30, 2020
bencelang added a commit that referenced this issue Mar 10, 2021
bencelang added a commit that referenced this issue Mar 10, 2021
@bencelang bencelang mentioned this issue Mar 10, 2021
7 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working enhancement New feature or request question Further information is requested
Development

Successfully merging a pull request may close this issue.

2 participants