Refactoring BasicXorEncryptor to make more readable.#228
Merged
Conversation
avalerio-tkd
commented
Mar 10, 2026
Collaborator
- Making BasicXorEncryptor more readable.
- Adding internal documentation and comments for guidance to future implementations.
- Adding a PrintableTypedValuesBuffer function to the TypedValuesBuffer class for debugging.
- Adding internal documentation and comments for guidance to future implementations. - Adding a PrintableTypedValuesBuffer function to the TypedValuesBuffer class for debugging.
argmarco-tkd
approved these changes
Mar 10, 2026
argmarco-tkd
left a comment
Collaborator
There was a problem hiding this comment.
LGTM - thank you! (left a minor comment around clarity in a comment. no need for a new PR).
Comment on lines
+74
to
+88
| // NOTE ON TYPE-SPECIFIC ENCRYPTION: | ||
| // | ||
| // The current implementation encrypts each element by interpreting the elements a plain bytes, | ||
| // not utilizing the specific type of the buffer elements (INT32, INT64, etc.). | ||
| // | ||
| // A more sophisticated implementation could take advantage of the specific element type | ||
| // to call type-specific encryption functions, if the underlying library supports them. | ||
| // | ||
| // For example, a type-specific encryption per element could look like: | ||
| // size_t i = 0; | ||
| // for (const int32_t element : input_buffer) { // e.g. int32_t for TypedBufferI32 | ||
| // auto encrypted = library.EncryptInt32(element, key_id); | ||
| // output_buffer.SetElement(i++, encrypted); | ||
| // } | ||
| // |
Collaborator
There was a problem hiding this comment.
This comment may be confusing (because the code is in fact aware of types - just that we're not using them at encryption time.
I recommend modifying the first paragraph of the comment to
While the `EncryptValueList` method is aware of types, this encryptor implementation currently ignores the type. It encrypts each element by interpreting the elements a plain bytes,
// not utilizing the specific type of the buffer elements (INT32, INT64, etc.).
Collaborator
Author
There was a problem hiding this comment.
Done. Thanks.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.