Can an RSA (private) modulus contain (hex) zeroes?
$begingroup$
Consider a private modulus that is supposedly 4096 bits. But since it contains two hex pairs of zeroes, i.e. ...:00:...:00... such that the bit length of the decimal value instead becomes 4093 bits, is it actually a 4096 bit key or not?
I hope my question is vaguely intelligible.
rsa
New contributor
$endgroup$
add a comment |
$begingroup$
Consider a private modulus that is supposedly 4096 bits. But since it contains two hex pairs of zeroes, i.e. ...:00:...:00... such that the bit length of the decimal value instead becomes 4093 bits, is it actually a 4096 bit key or not?
I hope my question is vaguely intelligible.
rsa
New contributor
$endgroup$
$begingroup$
Are you saying that the 2 most significant bytes are 0, or just there happen to be multiple zero substrings in places other than the most significant place? Also, why are your bringing up the decimal representation of the value?
$endgroup$
– Ken Goss
3 hours ago
$begingroup$
What's "the bit length of the decimal value" of an integer? How is 4093 obtained for 4096 and "two hex pairs of zeroes", that is 8 bits? Is "the private modulus" really the public modulus $N$ in an RSA public key $(N,e)$? If so; yes, $N$ may contain zeroes, in binary, hex, and decimal. By convention, the RSA key size is the bit size of $N$, that is the integer $k$ such that $2^{k-1}le N<2^k$. I may turn this into an answer if the question becomes clear.
$endgroup$
– fgrieu
4 mins ago
add a comment |
$begingroup$
Consider a private modulus that is supposedly 4096 bits. But since it contains two hex pairs of zeroes, i.e. ...:00:...:00... such that the bit length of the decimal value instead becomes 4093 bits, is it actually a 4096 bit key or not?
I hope my question is vaguely intelligible.
rsa
New contributor
$endgroup$
Consider a private modulus that is supposedly 4096 bits. But since it contains two hex pairs of zeroes, i.e. ...:00:...:00... such that the bit length of the decimal value instead becomes 4093 bits, is it actually a 4096 bit key or not?
I hope my question is vaguely intelligible.
rsa
rsa
New contributor
New contributor
New contributor
asked 3 hours ago
AdamAdam
61
61
New contributor
New contributor
$begingroup$
Are you saying that the 2 most significant bytes are 0, or just there happen to be multiple zero substrings in places other than the most significant place? Also, why are your bringing up the decimal representation of the value?
$endgroup$
– Ken Goss
3 hours ago
$begingroup$
What's "the bit length of the decimal value" of an integer? How is 4093 obtained for 4096 and "two hex pairs of zeroes", that is 8 bits? Is "the private modulus" really the public modulus $N$ in an RSA public key $(N,e)$? If so; yes, $N$ may contain zeroes, in binary, hex, and decimal. By convention, the RSA key size is the bit size of $N$, that is the integer $k$ such that $2^{k-1}le N<2^k$. I may turn this into an answer if the question becomes clear.
$endgroup$
– fgrieu
4 mins ago
add a comment |
$begingroup$
Are you saying that the 2 most significant bytes are 0, or just there happen to be multiple zero substrings in places other than the most significant place? Also, why are your bringing up the decimal representation of the value?
$endgroup$
– Ken Goss
3 hours ago
$begingroup$
What's "the bit length of the decimal value" of an integer? How is 4093 obtained for 4096 and "two hex pairs of zeroes", that is 8 bits? Is "the private modulus" really the public modulus $N$ in an RSA public key $(N,e)$? If so; yes, $N$ may contain zeroes, in binary, hex, and decimal. By convention, the RSA key size is the bit size of $N$, that is the integer $k$ such that $2^{k-1}le N<2^k$. I may turn this into an answer if the question becomes clear.
$endgroup$
– fgrieu
4 mins ago
$begingroup$
Are you saying that the 2 most significant bytes are 0, or just there happen to be multiple zero substrings in places other than the most significant place? Also, why are your bringing up the decimal representation of the value?
$endgroup$
– Ken Goss
3 hours ago
$begingroup$
Are you saying that the 2 most significant bytes are 0, or just there happen to be multiple zero substrings in places other than the most significant place? Also, why are your bringing up the decimal representation of the value?
$endgroup$
– Ken Goss
3 hours ago
$begingroup$
What's "the bit length of the decimal value" of an integer? How is 4093 obtained for 4096 and "two hex pairs of zeroes", that is 8 bits? Is "the private modulus" really the public modulus $N$ in an RSA public key $(N,e)$? If so; yes, $N$ may contain zeroes, in binary, hex, and decimal. By convention, the RSA key size is the bit size of $N$, that is the integer $k$ such that $2^{k-1}le N<2^k$. I may turn this into an answer if the question becomes clear.
$endgroup$
– fgrieu
4 mins ago
$begingroup$
What's "the bit length of the decimal value" of an integer? How is 4093 obtained for 4096 and "two hex pairs of zeroes", that is 8 bits? Is "the private modulus" really the public modulus $N$ in an RSA public key $(N,e)$? If so; yes, $N$ may contain zeroes, in binary, hex, and decimal. By convention, the RSA key size is the bit size of $N$, that is the integer $k$ such that $2^{k-1}le N<2^k$. I may turn this into an answer if the question becomes clear.
$endgroup$
– fgrieu
4 mins ago
add a comment |
1 Answer
1
active
oldest
votes
$begingroup$
There is no such thing as a "private modulus". There are the secret primes and the secret exponent, and there is the public modulus. Assuming you are talking about the primes or the secret exponent, are these bits in the most significant (leftmost) position, or are they somewhere in the middle or end? If they are in the most significant position, then they do not count towards the size of the integer. After all, any finite integer at all can be thought of as having an infinite number of leading zeros! If the zeros are somewhere within the integer, they serve to change its value. A random integer is expected to have a few null bytes.
Think about it this way: there is no difference between 0123 and 00123 (both are the same number), but there is a big ten-fold difference between 1230 and 12300, despite both adding a single zero. Of course this is base 10 whereas hex is base 16, but the principle is the same and zero means the same thing.
You can easily calculate the size of your key by taking the ceiling of the binary logarithm of the public modulus. That is, you can calculate $lceillog_2(N)rceil$ for an integer representation of the public modulus $N$.
$endgroup$
$begingroup$
Can't sleep. You need to take the ceiling, so I can look at the open air.
$endgroup$
– Maarten Bodewes♦
3 hours ago
$begingroup$
Too cryptic? The size of the RSA key is the ceiling of the log :)
$endgroup$
– Maarten Bodewes♦
3 hours ago
$begingroup$
@MaartenBodewes Good point. Without taking the ceiling, it's not even an integer.
$endgroup$
– forest
2 hours ago
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
});
});
}, "mathjax-editing");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "281"
};
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: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
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
},
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Adam is a new contributor. Be nice, and check out our Code of Conduct.
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%2fcrypto.stackexchange.com%2fquestions%2f66960%2fcan-an-rsa-private-modulus-contain-hex-zeroes%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
There is no such thing as a "private modulus". There are the secret primes and the secret exponent, and there is the public modulus. Assuming you are talking about the primes or the secret exponent, are these bits in the most significant (leftmost) position, or are they somewhere in the middle or end? If they are in the most significant position, then they do not count towards the size of the integer. After all, any finite integer at all can be thought of as having an infinite number of leading zeros! If the zeros are somewhere within the integer, they serve to change its value. A random integer is expected to have a few null bytes.
Think about it this way: there is no difference between 0123 and 00123 (both are the same number), but there is a big ten-fold difference between 1230 and 12300, despite both adding a single zero. Of course this is base 10 whereas hex is base 16, but the principle is the same and zero means the same thing.
You can easily calculate the size of your key by taking the ceiling of the binary logarithm of the public modulus. That is, you can calculate $lceillog_2(N)rceil$ for an integer representation of the public modulus $N$.
$endgroup$
$begingroup$
Can't sleep. You need to take the ceiling, so I can look at the open air.
$endgroup$
– Maarten Bodewes♦
3 hours ago
$begingroup$
Too cryptic? The size of the RSA key is the ceiling of the log :)
$endgroup$
– Maarten Bodewes♦
3 hours ago
$begingroup$
@MaartenBodewes Good point. Without taking the ceiling, it's not even an integer.
$endgroup$
– forest
2 hours ago
add a comment |
$begingroup$
There is no such thing as a "private modulus". There are the secret primes and the secret exponent, and there is the public modulus. Assuming you are talking about the primes or the secret exponent, are these bits in the most significant (leftmost) position, or are they somewhere in the middle or end? If they are in the most significant position, then they do not count towards the size of the integer. After all, any finite integer at all can be thought of as having an infinite number of leading zeros! If the zeros are somewhere within the integer, they serve to change its value. A random integer is expected to have a few null bytes.
Think about it this way: there is no difference between 0123 and 00123 (both are the same number), but there is a big ten-fold difference between 1230 and 12300, despite both adding a single zero. Of course this is base 10 whereas hex is base 16, but the principle is the same and zero means the same thing.
You can easily calculate the size of your key by taking the ceiling of the binary logarithm of the public modulus. That is, you can calculate $lceillog_2(N)rceil$ for an integer representation of the public modulus $N$.
$endgroup$
$begingroup$
Can't sleep. You need to take the ceiling, so I can look at the open air.
$endgroup$
– Maarten Bodewes♦
3 hours ago
$begingroup$
Too cryptic? The size of the RSA key is the ceiling of the log :)
$endgroup$
– Maarten Bodewes♦
3 hours ago
$begingroup$
@MaartenBodewes Good point. Without taking the ceiling, it's not even an integer.
$endgroup$
– forest
2 hours ago
add a comment |
$begingroup$
There is no such thing as a "private modulus". There are the secret primes and the secret exponent, and there is the public modulus. Assuming you are talking about the primes or the secret exponent, are these bits in the most significant (leftmost) position, or are they somewhere in the middle or end? If they are in the most significant position, then they do not count towards the size of the integer. After all, any finite integer at all can be thought of as having an infinite number of leading zeros! If the zeros are somewhere within the integer, they serve to change its value. A random integer is expected to have a few null bytes.
Think about it this way: there is no difference between 0123 and 00123 (both are the same number), but there is a big ten-fold difference between 1230 and 12300, despite both adding a single zero. Of course this is base 10 whereas hex is base 16, but the principle is the same and zero means the same thing.
You can easily calculate the size of your key by taking the ceiling of the binary logarithm of the public modulus. That is, you can calculate $lceillog_2(N)rceil$ for an integer representation of the public modulus $N$.
$endgroup$
There is no such thing as a "private modulus". There are the secret primes and the secret exponent, and there is the public modulus. Assuming you are talking about the primes or the secret exponent, are these bits in the most significant (leftmost) position, or are they somewhere in the middle or end? If they are in the most significant position, then they do not count towards the size of the integer. After all, any finite integer at all can be thought of as having an infinite number of leading zeros! If the zeros are somewhere within the integer, they serve to change its value. A random integer is expected to have a few null bytes.
Think about it this way: there is no difference between 0123 and 00123 (both are the same number), but there is a big ten-fold difference between 1230 and 12300, despite both adding a single zero. Of course this is base 10 whereas hex is base 16, but the principle is the same and zero means the same thing.
You can easily calculate the size of your key by taking the ceiling of the binary logarithm of the public modulus. That is, you can calculate $lceillog_2(N)rceil$ for an integer representation of the public modulus $N$.
edited 1 hour ago
answered 3 hours ago
forestforest
3,4901338
3,4901338
$begingroup$
Can't sleep. You need to take the ceiling, so I can look at the open air.
$endgroup$
– Maarten Bodewes♦
3 hours ago
$begingroup$
Too cryptic? The size of the RSA key is the ceiling of the log :)
$endgroup$
– Maarten Bodewes♦
3 hours ago
$begingroup$
@MaartenBodewes Good point. Without taking the ceiling, it's not even an integer.
$endgroup$
– forest
2 hours ago
add a comment |
$begingroup$
Can't sleep. You need to take the ceiling, so I can look at the open air.
$endgroup$
– Maarten Bodewes♦
3 hours ago
$begingroup$
Too cryptic? The size of the RSA key is the ceiling of the log :)
$endgroup$
– Maarten Bodewes♦
3 hours ago
$begingroup$
@MaartenBodewes Good point. Without taking the ceiling, it's not even an integer.
$endgroup$
– forest
2 hours ago
$begingroup$
Can't sleep. You need to take the ceiling, so I can look at the open air.
$endgroup$
– Maarten Bodewes♦
3 hours ago
$begingroup$
Can't sleep. You need to take the ceiling, so I can look at the open air.
$endgroup$
– Maarten Bodewes♦
3 hours ago
$begingroup$
Too cryptic? The size of the RSA key is the ceiling of the log :)
$endgroup$
– Maarten Bodewes♦
3 hours ago
$begingroup$
Too cryptic? The size of the RSA key is the ceiling of the log :)
$endgroup$
– Maarten Bodewes♦
3 hours ago
$begingroup$
@MaartenBodewes Good point. Without taking the ceiling, it's not even an integer.
$endgroup$
– forest
2 hours ago
$begingroup$
@MaartenBodewes Good point. Without taking the ceiling, it's not even an integer.
$endgroup$
– forest
2 hours ago
add a comment |
Adam is a new contributor. Be nice, and check out our Code of Conduct.
Adam is a new contributor. Be nice, and check out our Code of Conduct.
Adam is a new contributor. Be nice, and check out our Code of Conduct.
Adam is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Cryptography Stack Exchange!
- 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.
Use MathJax to format equations. MathJax reference.
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%2fcrypto.stackexchange.com%2fquestions%2f66960%2fcan-an-rsa-private-modulus-contain-hex-zeroes%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
$begingroup$
Are you saying that the 2 most significant bytes are 0, or just there happen to be multiple zero substrings in places other than the most significant place? Also, why are your bringing up the decimal representation of the value?
$endgroup$
– Ken Goss
3 hours ago
$begingroup$
What's "the bit length of the decimal value" of an integer? How is 4093 obtained for 4096 and "two hex pairs of zeroes", that is 8 bits? Is "the private modulus" really the public modulus $N$ in an RSA public key $(N,e)$? If so; yes, $N$ may contain zeroes, in binary, hex, and decimal. By convention, the RSA key size is the bit size of $N$, that is the integer $k$ such that $2^{k-1}le N<2^k$. I may turn this into an answer if the question becomes clear.
$endgroup$
– fgrieu
4 mins ago