Do you really need a KDF when you have a PRF?ECDH security when no KDF is usedDeriving Keys for Symmetric Encryption and AuthenticationDifference between Pseudorandom Function vs randomly chosen functionECDH security when no KDF is usedsecurity for PRF when key is changed oftenHow can a hash function be suitable for hashing passwords, but not for deriving enctyption keys, and vice versa?PBKDF security if all but one keys are exposedRelationship between PRF/KDF/MAC?Key derivation: Does it make sense to use KDF and PRF consecutively?KDF Salt: How/When is it Okay for it to be public?What are the disadvantages of XOR key derivation?

How can one's career as a reviewer be ended?

How and why do references in academic papers work?

Why did the World Bank set the global poverty line at $1.90?

That's not my X, its Y is too Z

Rail-to-rail op-amp only reaches 90% of VCC, works sometimes, not everytime

What plausible reason could I give for my FTL drive only working in space

A Salute to Poetry

Are the guests in Westworld forbidden to tell the hosts that they are robots?

What would be the way to say "just saying" in German? (Not the literal translation)

What differences exist between adamantine and adamantite in all editions of D&D?

What should I be wary of when insurer is taking a lot of time to decide whether car is repairable or a total loss?

Why ambiguous grammars are bad?

Housemarks (superimposed & combined letters, heraldry)

Why is the length of the Kelvin unit of temperature equal to that of the Celsius unit?

Cathode rays and the cathode rays tube

Why do radiation hardened IC packages often have long leads?

Does the new finding on "reversing a quantum jump mid-flight" rule out any interpretations of QM?

Command of files and size

What STL algorithm can determine if exactly one item in a container satisfies a predicate?

Assigning function to function pointer, const argument correctness?

Should I put programming books I wrote a few years ago on my resume?

C++ logging library

How make a table fit inside the margins?

Wizard clothing for warm weather



Do you really need a KDF when you have a PRF?


ECDH security when no KDF is usedDeriving Keys for Symmetric Encryption and AuthenticationDifference between Pseudorandom Function vs randomly chosen functionECDH security when no KDF is usedsecurity for PRF when key is changed oftenHow can a hash function be suitable for hashing passwords, but not for deriving enctyption keys, and vice versa?PBKDF security if all but one keys are exposedRelationship between PRF/KDF/MAC?Key derivation: Does it make sense to use KDF and PRF consecutively?KDF Salt: How/When is it Okay for it to be public?What are the disadvantages of XOR key derivation?













2












$begingroup$


My understanding is that a KDF is like a PRF, except that it has a preliminary step that "extract" entropy. It is thus needed when the entropy is non-uniform (for example the output of ECDH is modulo a number that is not a power of 2, and is thus non-uniform if represented as a bit-string).



Yet, I am not sure there are modern symmetric algorithms that require the secret to be uniformly distributed. Sure their security might be defined with a uniform key, but using a KDF feels a bit like a cheat since there is no new entropy added, and it's not slow either. Am I missing something?










share|improve this question









$endgroup$







  • 1




    $begingroup$
    What is meant by "algorithms that require the secret to be uniformly distributed"? Specifically the word "require"; If the algorithms definition says it needs a uniform key, doesn't that mean it requires the secret to be uniformly distributed? Or do you mean "require" as in "security would become broken in practice if the secret is not uniformly distributed"?
    $endgroup$
    – Ella Rose
    7 hours ago















2












$begingroup$


My understanding is that a KDF is like a PRF, except that it has a preliminary step that "extract" entropy. It is thus needed when the entropy is non-uniform (for example the output of ECDH is modulo a number that is not a power of 2, and is thus non-uniform if represented as a bit-string).



Yet, I am not sure there are modern symmetric algorithms that require the secret to be uniformly distributed. Sure their security might be defined with a uniform key, but using a KDF feels a bit like a cheat since there is no new entropy added, and it's not slow either. Am I missing something?










share|improve this question









$endgroup$







  • 1




    $begingroup$
    What is meant by "algorithms that require the secret to be uniformly distributed"? Specifically the word "require"; If the algorithms definition says it needs a uniform key, doesn't that mean it requires the secret to be uniformly distributed? Or do you mean "require" as in "security would become broken in practice if the secret is not uniformly distributed"?
    $endgroup$
    – Ella Rose
    7 hours ago













2












2








2





$begingroup$


My understanding is that a KDF is like a PRF, except that it has a preliminary step that "extract" entropy. It is thus needed when the entropy is non-uniform (for example the output of ECDH is modulo a number that is not a power of 2, and is thus non-uniform if represented as a bit-string).



Yet, I am not sure there are modern symmetric algorithms that require the secret to be uniformly distributed. Sure their security might be defined with a uniform key, but using a KDF feels a bit like a cheat since there is no new entropy added, and it's not slow either. Am I missing something?










share|improve this question









$endgroup$




My understanding is that a KDF is like a PRF, except that it has a preliminary step that "extract" entropy. It is thus needed when the entropy is non-uniform (for example the output of ECDH is modulo a number that is not a power of 2, and is thus non-uniform if represented as a bit-string).



Yet, I am not sure there are modern symmetric algorithms that require the secret to be uniformly distributed. Sure their security might be defined with a uniform key, but using a KDF feels a bit like a cheat since there is no new entropy added, and it's not slow either. Am I missing something?







key-derivation pseudo-random-function hkdf






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked 8 hours ago









David 天宇 WongDavid 天宇 Wong

701618




701618







  • 1




    $begingroup$
    What is meant by "algorithms that require the secret to be uniformly distributed"? Specifically the word "require"; If the algorithms definition says it needs a uniform key, doesn't that mean it requires the secret to be uniformly distributed? Or do you mean "require" as in "security would become broken in practice if the secret is not uniformly distributed"?
    $endgroup$
    – Ella Rose
    7 hours ago












  • 1




    $begingroup$
    What is meant by "algorithms that require the secret to be uniformly distributed"? Specifically the word "require"; If the algorithms definition says it needs a uniform key, doesn't that mean it requires the secret to be uniformly distributed? Or do you mean "require" as in "security would become broken in practice if the secret is not uniformly distributed"?
    $endgroup$
    – Ella Rose
    7 hours ago







1




1




$begingroup$
What is meant by "algorithms that require the secret to be uniformly distributed"? Specifically the word "require"; If the algorithms definition says it needs a uniform key, doesn't that mean it requires the secret to be uniformly distributed? Or do you mean "require" as in "security would become broken in practice if the secret is not uniformly distributed"?
$endgroup$
– Ella Rose
7 hours ago




$begingroup$
What is meant by "algorithms that require the secret to be uniformly distributed"? Specifically the word "require"; If the algorithms definition says it needs a uniform key, doesn't that mean it requires the secret to be uniformly distributed? Or do you mean "require" as in "security would become broken in practice if the secret is not uniformly distributed"?
$endgroup$
– Ella Rose
7 hours ago










1 Answer
1






active

oldest

votes


















3












$begingroup$


Do you really need a KDF when you have a PRF?




The purpose of the ‘expand’ step of a KDF like HKDF-Expand is to yield essentially arbitrary-size keys for distinct input labels. It is, in fact, a PRF. If you look closely, you will see that $$operatornameHKDF-Expand_k(L) = operatornameHMAC-!H_k(L mathbin| mathtt0x01),$$ if the desired output size matches the output size of $H$; if more bytes are requested, just repeatedly call $operatornameHMAC-!H$ with consecutive counters and the previous chunk prepended to $L$, and concatenate the outputs. You could, of course, substitute for $operatornameHMAC-!H$ your favorite PRF like keyed BLAKE2b, KMAC128, KangarooTwelve, Kravatte, prefix-keyed Gimli-Hash, or ChaCha $circ$ Poly1305, and while it wouldn't be HKDF it would have corresponding security.




My understanding is that a KDF is like a PRF, except that it has a preliminary step that "extract" entropy. It is thus needed when the entropy is non-uniform (for example the output of ECDH is modulo a number that is not a power of 2, and is thus non-uniform if represented as a bit-string).




Correct: The other purpose of collecting the concepts of extract-with-salt and expand-with-label into a single term KDF is that often the two steps are close by—you have a DH secret, or a master diceware seed, which is not uniform in bit strings but which has high entropy, and you want to derive many secret keys from it for different labeled purposes.




Yet, I am not sure there are modern symmetric algorithms that require the secret to be uniformly distributed. Sure their security might be defined with a uniform key, but using a KDF feels a bit like a cheat since there is no new entropy added, and it's not slow either. Am I missing something?




The security contract for many cryptographic primitives requires the input to be uniform random. Obviously you can choose the input by a pseudorandom function under a uniform random key—if that broke the composition, merely using the composition would then serve as a distinguisher for the pseudorandom function. But it's not a priori clear whether highly structured keys like the bit encodings of integers on particular curves might be exploitable in downstream cryptosystems; using HKDF-Extract, or otherwise hashing the input, renders these concerns moot so you don't even have to think about them.






share|improve this answer











$endgroup$













    Your Answer








    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
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcrypto.stackexchange.com%2fquestions%2f71184%2fdo-you-really-need-a-kdf-when-you-have-a-prf%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









    3












    $begingroup$


    Do you really need a KDF when you have a PRF?




    The purpose of the ‘expand’ step of a KDF like HKDF-Expand is to yield essentially arbitrary-size keys for distinct input labels. It is, in fact, a PRF. If you look closely, you will see that $$operatornameHKDF-Expand_k(L) = operatornameHMAC-!H_k(L mathbin| mathtt0x01),$$ if the desired output size matches the output size of $H$; if more bytes are requested, just repeatedly call $operatornameHMAC-!H$ with consecutive counters and the previous chunk prepended to $L$, and concatenate the outputs. You could, of course, substitute for $operatornameHMAC-!H$ your favorite PRF like keyed BLAKE2b, KMAC128, KangarooTwelve, Kravatte, prefix-keyed Gimli-Hash, or ChaCha $circ$ Poly1305, and while it wouldn't be HKDF it would have corresponding security.




    My understanding is that a KDF is like a PRF, except that it has a preliminary step that "extract" entropy. It is thus needed when the entropy is non-uniform (for example the output of ECDH is modulo a number that is not a power of 2, and is thus non-uniform if represented as a bit-string).




    Correct: The other purpose of collecting the concepts of extract-with-salt and expand-with-label into a single term KDF is that often the two steps are close by—you have a DH secret, or a master diceware seed, which is not uniform in bit strings but which has high entropy, and you want to derive many secret keys from it for different labeled purposes.




    Yet, I am not sure there are modern symmetric algorithms that require the secret to be uniformly distributed. Sure their security might be defined with a uniform key, but using a KDF feels a bit like a cheat since there is no new entropy added, and it's not slow either. Am I missing something?




    The security contract for many cryptographic primitives requires the input to be uniform random. Obviously you can choose the input by a pseudorandom function under a uniform random key—if that broke the composition, merely using the composition would then serve as a distinguisher for the pseudorandom function. But it's not a priori clear whether highly structured keys like the bit encodings of integers on particular curves might be exploitable in downstream cryptosystems; using HKDF-Extract, or otherwise hashing the input, renders these concerns moot so you don't even have to think about them.






    share|improve this answer











    $endgroup$

















      3












      $begingroup$


      Do you really need a KDF when you have a PRF?




      The purpose of the ‘expand’ step of a KDF like HKDF-Expand is to yield essentially arbitrary-size keys for distinct input labels. It is, in fact, a PRF. If you look closely, you will see that $$operatornameHKDF-Expand_k(L) = operatornameHMAC-!H_k(L mathbin| mathtt0x01),$$ if the desired output size matches the output size of $H$; if more bytes are requested, just repeatedly call $operatornameHMAC-!H$ with consecutive counters and the previous chunk prepended to $L$, and concatenate the outputs. You could, of course, substitute for $operatornameHMAC-!H$ your favorite PRF like keyed BLAKE2b, KMAC128, KangarooTwelve, Kravatte, prefix-keyed Gimli-Hash, or ChaCha $circ$ Poly1305, and while it wouldn't be HKDF it would have corresponding security.




      My understanding is that a KDF is like a PRF, except that it has a preliminary step that "extract" entropy. It is thus needed when the entropy is non-uniform (for example the output of ECDH is modulo a number that is not a power of 2, and is thus non-uniform if represented as a bit-string).




      Correct: The other purpose of collecting the concepts of extract-with-salt and expand-with-label into a single term KDF is that often the two steps are close by—you have a DH secret, or a master diceware seed, which is not uniform in bit strings but which has high entropy, and you want to derive many secret keys from it for different labeled purposes.




      Yet, I am not sure there are modern symmetric algorithms that require the secret to be uniformly distributed. Sure their security might be defined with a uniform key, but using a KDF feels a bit like a cheat since there is no new entropy added, and it's not slow either. Am I missing something?




      The security contract for many cryptographic primitives requires the input to be uniform random. Obviously you can choose the input by a pseudorandom function under a uniform random key—if that broke the composition, merely using the composition would then serve as a distinguisher for the pseudorandom function. But it's not a priori clear whether highly structured keys like the bit encodings of integers on particular curves might be exploitable in downstream cryptosystems; using HKDF-Extract, or otherwise hashing the input, renders these concerns moot so you don't even have to think about them.






      share|improve this answer











      $endgroup$















        3












        3








        3





        $begingroup$


        Do you really need a KDF when you have a PRF?




        The purpose of the ‘expand’ step of a KDF like HKDF-Expand is to yield essentially arbitrary-size keys for distinct input labels. It is, in fact, a PRF. If you look closely, you will see that $$operatornameHKDF-Expand_k(L) = operatornameHMAC-!H_k(L mathbin| mathtt0x01),$$ if the desired output size matches the output size of $H$; if more bytes are requested, just repeatedly call $operatornameHMAC-!H$ with consecutive counters and the previous chunk prepended to $L$, and concatenate the outputs. You could, of course, substitute for $operatornameHMAC-!H$ your favorite PRF like keyed BLAKE2b, KMAC128, KangarooTwelve, Kravatte, prefix-keyed Gimli-Hash, or ChaCha $circ$ Poly1305, and while it wouldn't be HKDF it would have corresponding security.




        My understanding is that a KDF is like a PRF, except that it has a preliminary step that "extract" entropy. It is thus needed when the entropy is non-uniform (for example the output of ECDH is modulo a number that is not a power of 2, and is thus non-uniform if represented as a bit-string).




        Correct: The other purpose of collecting the concepts of extract-with-salt and expand-with-label into a single term KDF is that often the two steps are close by—you have a DH secret, or a master diceware seed, which is not uniform in bit strings but which has high entropy, and you want to derive many secret keys from it for different labeled purposes.




        Yet, I am not sure there are modern symmetric algorithms that require the secret to be uniformly distributed. Sure their security might be defined with a uniform key, but using a KDF feels a bit like a cheat since there is no new entropy added, and it's not slow either. Am I missing something?




        The security contract for many cryptographic primitives requires the input to be uniform random. Obviously you can choose the input by a pseudorandom function under a uniform random key—if that broke the composition, merely using the composition would then serve as a distinguisher for the pseudorandom function. But it's not a priori clear whether highly structured keys like the bit encodings of integers on particular curves might be exploitable in downstream cryptosystems; using HKDF-Extract, or otherwise hashing the input, renders these concerns moot so you don't even have to think about them.






        share|improve this answer











        $endgroup$




        Do you really need a KDF when you have a PRF?




        The purpose of the ‘expand’ step of a KDF like HKDF-Expand is to yield essentially arbitrary-size keys for distinct input labels. It is, in fact, a PRF. If you look closely, you will see that $$operatornameHKDF-Expand_k(L) = operatornameHMAC-!H_k(L mathbin| mathtt0x01),$$ if the desired output size matches the output size of $H$; if more bytes are requested, just repeatedly call $operatornameHMAC-!H$ with consecutive counters and the previous chunk prepended to $L$, and concatenate the outputs. You could, of course, substitute for $operatornameHMAC-!H$ your favorite PRF like keyed BLAKE2b, KMAC128, KangarooTwelve, Kravatte, prefix-keyed Gimli-Hash, or ChaCha $circ$ Poly1305, and while it wouldn't be HKDF it would have corresponding security.




        My understanding is that a KDF is like a PRF, except that it has a preliminary step that "extract" entropy. It is thus needed when the entropy is non-uniform (for example the output of ECDH is modulo a number that is not a power of 2, and is thus non-uniform if represented as a bit-string).




        Correct: The other purpose of collecting the concepts of extract-with-salt and expand-with-label into a single term KDF is that often the two steps are close by—you have a DH secret, or a master diceware seed, which is not uniform in bit strings but which has high entropy, and you want to derive many secret keys from it for different labeled purposes.




        Yet, I am not sure there are modern symmetric algorithms that require the secret to be uniformly distributed. Sure their security might be defined with a uniform key, but using a KDF feels a bit like a cheat since there is no new entropy added, and it's not slow either. Am I missing something?




        The security contract for many cryptographic primitives requires the input to be uniform random. Obviously you can choose the input by a pseudorandom function under a uniform random key—if that broke the composition, merely using the composition would then serve as a distinguisher for the pseudorandom function. But it's not a priori clear whether highly structured keys like the bit encodings of integers on particular curves might be exploitable in downstream cryptosystems; using HKDF-Extract, or otherwise hashing the input, renders these concerns moot so you don't even have to think about them.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited 5 hours ago

























        answered 7 hours ago









        Squeamish OssifrageSqueamish Ossifrage

        27.6k144121




        27.6k144121



























            draft saved

            draft discarded
















































            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.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcrypto.stackexchange.com%2fquestions%2f71184%2fdo-you-really-need-a-kdf-when-you-have-a-prf%23new-answer', 'question_page');

            );

            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







            Popular posts from this blog

            Invision Community Contents History See also References External links Navigation menuProprietaryinvisioncommunity.comIPS Community ForumsIPS Community Forumsthis blog entry"License Changes, IP.Board 3.4, and the Future""Interview -- Matt Mecham of Ibforums""CEO Invision Power Board, Matt Mecham Is a Liar, Thief!"IPB License Explanation 1.3, 1.3.1, 2.0, and 2.1ArchivedSecurity Fixes, Updates And Enhancements For IPB 1.3.1Archived"New Demo Accounts - Invision Power Services"the original"New Default Skin"the original"Invision Power Board 3.0.0 and Applications Released"the original"Archived copy"the original"Perpetual licenses being done away with""Release Notes - Invision Power Services""Introducing: IPS Community Suite 4!"Invision Community Release Notes

            Canceling a color specificationRandomly assigning color to Graphics3D objects?Default color for Filling in Mathematica 9Coloring specific elements of sets with a prime modified order in an array plotHow to pick a color differing significantly from the colors already in a given color list?Detection of the text colorColor numbers based on their valueCan color schemes for use with ColorData include opacity specification?My dynamic color schemes

            Tom Holland Mục lục Đầu đời và giáo dục | Sự nghiệp | Cuộc sống cá nhân | Phim tham gia | Giải thưởng và đề cử | Chú thích | Liên kết ngoài | Trình đơn chuyển hướngProfile“Person Details for Thomas Stanley Holland, "England and Wales Birth Registration Index, 1837-2008" — FamilySearch.org”"Meet Tom Holland... the 16-year-old star of The Impossible""Schoolboy actor Tom Holland finds himself in Oscar contention for role in tsunami drama"“Naomi Watts on the Prince William and Harry's reaction to her film about the late Princess Diana”lưu trữ"Holland and Pflueger Are West End's Two New 'Billy Elliots'""I'm so envious of my son, the movie star! British writer Dominic Holland's spent 20 years trying to crack Hollywood - but he's been beaten to it by a very unlikely rival"“Richard and Margaret Povey of Jersey, Channel Islands, UK: Information about Thomas Stanley Holland”"Tom Holland to play Billy Elliot""New Billy Elliot leaving the garage"Billy Elliot the Musical - Tom Holland - Billy"A Tale of four Billys: Tom Holland""The Feel Good Factor""Thames Christian College schoolboys join Myleene Klass for The Feelgood Factor""Government launches £600,000 arts bursaries pilot""BILLY's Chapman, Holland, Gardner & Jackson-Keen Visit Prime Minister""Elton John 'blown away' by Billy Elliot fifth birthday" (video with John's interview and fragments of Holland's performance)"First News interviews Arrietty's Tom Holland"“33rd Critics' Circle Film Awards winners”“National Board of Review Current Awards”Bản gốc"Ron Howard Whaling Tale 'In The Heart Of The Sea' Casts Tom Holland"“'Spider-Man' Finds Tom Holland to Star as New Web-Slinger”lưu trữ“Captain America: Civil War (2016)”“Film Review: ‘Captain America: Civil War’”lưu trữ“‘Captain America: Civil War’ review: Choose your own avenger”lưu trữ“The Lost City of Z reviews”“Sony Pictures and Marvel Studios Find Their 'Spider-Man' Star and Director”“‘Mary Magdalene’, ‘Current War’ & ‘Wind River’ Get 2017 Release Dates From Weinstein”“Lionsgate Unleashing Daisy Ridley & Tom Holland Starrer ‘Chaos Walking’ In Cannes”“PTA's 'Master' Leads Chicago Film Critics Nominations, UPDATED: Houston and Indiana Critics Nominations”“Nominaciones Goya 2013 Telecinco Cinema – ENG”“Jameson Empire Film Awards: Martin Freeman wins best actor for performance in The Hobbit”“34th Annual Young Artist Awards”Bản gốc“Teen Choice Awards 2016—Captain America: Civil War Leads Second Wave of Nominations”“BAFTA Film Award Nominations: ‘La La Land’ Leads Race”“Saturn Awards Nominations 2017: 'Rogue One,' 'Walking Dead' Lead”Tom HollandTom HollandTom HollandTom Hollandmedia.gettyimages.comWorldCat Identities300279794no20130442900000 0004 0355 42791085670554170004732cb16706349t(data)XX5557367