Does base64 encoding preserve alphabetical ordering?
Let's say I have a list of 100 words, sorted in alphabetical order.
If I base64 encode these words, and then order the resulting list again, will the order if the elements be the same?
If not, is there any other encoding algorithm that will provide this behaviour for me?
sorting encoding base64
add a comment |
Let's say I have a list of 100 words, sorted in alphabetical order.
If I base64 encode these words, and then order the resulting list again, will the order if the elements be the same?
If not, is there any other encoding algorithm that will provide this behaviour for me?
sorting encoding base64
This sounds very easily test-able with very minimal effort. Check out base64encode.org. My guess is that yes the order is preserved between encoding and decoding with base64.
– MonkeyZeus
Nov 14 '18 at 16:49
I can run a small test like that and see if the sorting is maintained for that set, but it's hard to actually prove that will work for all sets of words. I'm afraid there will be some rare cases where the ordering is not preserved.
– Bart van der Drift
Nov 15 '18 at 12:01
I honestly do not understand the exact situation which you are afraid of. Can you provide a sample of what you fear will happen?
– MonkeyZeus
Nov 15 '18 at 12:32
Sure, we have a large set of data which will be exposed by an API. We want to return the data set in pages, where each page contains a continuation token that points to the next page. We also want the data set to be returned in alphabetical order of a certain field in the data. So the idea was to concatenate this field with its record ID (for uniqueness) and then save that value as an extra column in the database. Then we can use that column as the continuation token and easily select the next top X records.
– Bart van der Drift
Nov 21 '18 at 7:45
If the alphabetical order is not preserved by base64 encoding, that could result in missing records from the result set.
– Bart van der Drift
Nov 21 '18 at 7:45
add a comment |
Let's say I have a list of 100 words, sorted in alphabetical order.
If I base64 encode these words, and then order the resulting list again, will the order if the elements be the same?
If not, is there any other encoding algorithm that will provide this behaviour for me?
sorting encoding base64
Let's say I have a list of 100 words, sorted in alphabetical order.
If I base64 encode these words, and then order the resulting list again, will the order if the elements be the same?
If not, is there any other encoding algorithm that will provide this behaviour for me?
sorting encoding base64
sorting encoding base64
asked Nov 14 '18 at 13:23
Bart van der DriftBart van der Drift
714621
714621
This sounds very easily test-able with very minimal effort. Check out base64encode.org. My guess is that yes the order is preserved between encoding and decoding with base64.
– MonkeyZeus
Nov 14 '18 at 16:49
I can run a small test like that and see if the sorting is maintained for that set, but it's hard to actually prove that will work for all sets of words. I'm afraid there will be some rare cases where the ordering is not preserved.
– Bart van der Drift
Nov 15 '18 at 12:01
I honestly do not understand the exact situation which you are afraid of. Can you provide a sample of what you fear will happen?
– MonkeyZeus
Nov 15 '18 at 12:32
Sure, we have a large set of data which will be exposed by an API. We want to return the data set in pages, where each page contains a continuation token that points to the next page. We also want the data set to be returned in alphabetical order of a certain field in the data. So the idea was to concatenate this field with its record ID (for uniqueness) and then save that value as an extra column in the database. Then we can use that column as the continuation token and easily select the next top X records.
– Bart van der Drift
Nov 21 '18 at 7:45
If the alphabetical order is not preserved by base64 encoding, that could result in missing records from the result set.
– Bart van der Drift
Nov 21 '18 at 7:45
add a comment |
This sounds very easily test-able with very minimal effort. Check out base64encode.org. My guess is that yes the order is preserved between encoding and decoding with base64.
– MonkeyZeus
Nov 14 '18 at 16:49
I can run a small test like that and see if the sorting is maintained for that set, but it's hard to actually prove that will work for all sets of words. I'm afraid there will be some rare cases where the ordering is not preserved.
– Bart van der Drift
Nov 15 '18 at 12:01
I honestly do not understand the exact situation which you are afraid of. Can you provide a sample of what you fear will happen?
– MonkeyZeus
Nov 15 '18 at 12:32
Sure, we have a large set of data which will be exposed by an API. We want to return the data set in pages, where each page contains a continuation token that points to the next page. We also want the data set to be returned in alphabetical order of a certain field in the data. So the idea was to concatenate this field with its record ID (for uniqueness) and then save that value as an extra column in the database. Then we can use that column as the continuation token and easily select the next top X records.
– Bart van der Drift
Nov 21 '18 at 7:45
If the alphabetical order is not preserved by base64 encoding, that could result in missing records from the result set.
– Bart van der Drift
Nov 21 '18 at 7:45
This sounds very easily test-able with very minimal effort. Check out base64encode.org. My guess is that yes the order is preserved between encoding and decoding with base64.
– MonkeyZeus
Nov 14 '18 at 16:49
This sounds very easily test-able with very minimal effort. Check out base64encode.org. My guess is that yes the order is preserved between encoding and decoding with base64.
– MonkeyZeus
Nov 14 '18 at 16:49
I can run a small test like that and see if the sorting is maintained for that set, but it's hard to actually prove that will work for all sets of words. I'm afraid there will be some rare cases where the ordering is not preserved.
– Bart van der Drift
Nov 15 '18 at 12:01
I can run a small test like that and see if the sorting is maintained for that set, but it's hard to actually prove that will work for all sets of words. I'm afraid there will be some rare cases where the ordering is not preserved.
– Bart van der Drift
Nov 15 '18 at 12:01
I honestly do not understand the exact situation which you are afraid of. Can you provide a sample of what you fear will happen?
– MonkeyZeus
Nov 15 '18 at 12:32
I honestly do not understand the exact situation which you are afraid of. Can you provide a sample of what you fear will happen?
– MonkeyZeus
Nov 15 '18 at 12:32
Sure, we have a large set of data which will be exposed by an API. We want to return the data set in pages, where each page contains a continuation token that points to the next page. We also want the data set to be returned in alphabetical order of a certain field in the data. So the idea was to concatenate this field with its record ID (for uniqueness) and then save that value as an extra column in the database. Then we can use that column as the continuation token and easily select the next top X records.
– Bart van der Drift
Nov 21 '18 at 7:45
Sure, we have a large set of data which will be exposed by an API. We want to return the data set in pages, where each page contains a continuation token that points to the next page. We also want the data set to be returned in alphabetical order of a certain field in the data. So the idea was to concatenate this field with its record ID (for uniqueness) and then save that value as an extra column in the database. Then we can use that column as the continuation token and easily select the next top X records.
– Bart van der Drift
Nov 21 '18 at 7:45
If the alphabetical order is not preserved by base64 encoding, that could result in missing records from the result set.
– Bart van der Drift
Nov 21 '18 at 7:45
If the alphabetical order is not preserved by base64 encoding, that could result in missing records from the result set.
– Bart van der Drift
Nov 21 '18 at 7:45
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53301280%2fdoes-base64-encoding-preserve-alphabetical-ordering%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53301280%2fdoes-base64-encoding-preserve-alphabetical-ordering%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
This sounds very easily test-able with very minimal effort. Check out base64encode.org. My guess is that yes the order is preserved between encoding and decoding with base64.
– MonkeyZeus
Nov 14 '18 at 16:49
I can run a small test like that and see if the sorting is maintained for that set, but it's hard to actually prove that will work for all sets of words. I'm afraid there will be some rare cases where the ordering is not preserved.
– Bart van der Drift
Nov 15 '18 at 12:01
I honestly do not understand the exact situation which you are afraid of. Can you provide a sample of what you fear will happen?
– MonkeyZeus
Nov 15 '18 at 12:32
Sure, we have a large set of data which will be exposed by an API. We want to return the data set in pages, where each page contains a continuation token that points to the next page. We also want the data set to be returned in alphabetical order of a certain field in the data. So the idea was to concatenate this field with its record ID (for uniqueness) and then save that value as an extra column in the database. Then we can use that column as the continuation token and easily select the next top X records.
– Bart van der Drift
Nov 21 '18 at 7:45
If the alphabetical order is not preserved by base64 encoding, that could result in missing records from the result set.
– Bart van der Drift
Nov 21 '18 at 7:45