<oembed><type>rich</type><version>1.0</version><author_name>npub12hzwfhx9ptjf2f0va8qllc0h4tcvz5aaefvlvn9uq8z2ssrq027qtvtmxa</author_name><author_url>https://nostr.ae/npub12hzwfhx9ptjf2f0va8qllc0h4tcvz5aaefvlvn9uq8z2ssrq027qtvtmxa</author_url><provider_name>njump</provider_name><provider_url>https://nostr.ae</provider_url><html>📅 Original date posted:2014-07-15&#xA;📝 Original message:I was part of adding in that test vector, and I think it&#39;s a good test&#xA;vector since it is an extreme edge-case of the current definition: If the&#xA;BIP38 proposal allows any password that can be in UTF-8, NFC normalized&#xA;form, those characters cover the various edge cases (combining characters,&#xA;null character, astral range) that if your implementation doesn&#39;t handle,&#xA;then it can&#39;t really be said to be &#34;BIP38-compatible/compliant&#34;, right?&#xA;&#xA;The &#34;passphrase&#34; in the test vector is NOT in NFC form; that&#39;s the point.&#xA;Whatever implementation gets designed has to assume the input is not&#xA;already NFC-normalized and needs to handle/sanitize that input before&#xA;further processing. To test your implementation for compliance, you should&#xA;not be inputting the NFC-normalized bytestring as the password input, you&#xA;should be entering the original passphrase as the test. My original pull&#xA;request for this change (https://github.com/bitcoin/bips/pull/29) shows a&#xA;Python and a NodeJS way to input that test vector password as intended.&#xA;&#xA;Some input devices may already handle the input as NFC, which is great, but&#xA;per the BIP38 proposal, that shouldn&#39;t be assumed, so various&#xA;implementations are cross-compatible. If one implementation assumes the&#xA;input is already NFC, they may encode/decode the password incorrectly, and&#xA;lock a user out of their wallet. Android allows different user keyboards to&#xA;be used, so I&#39;m guessing there&#39;s one somewhere that allows manual entry of&#xA;unicode codepoints that could be used to enter a null character, and with&#xA;the next version of iOS, Apple devices will also get custom keyboard&#xA;options, too, so even if the default Apple keyboard does NFC-form properly,&#xA;other developers&#39; keyboards may not. So while it is an extreme edge case,&#xA;that is not very likely to be used as a &#34;real password&#34; by any user, that&#39;s&#xA;what test vectors are for: to test for the edge case that you might not&#xA;have expected and handled in your implementation.&#xA;&#xA;Brooks&#xA;&#xA;&#xA;On Tue, Jul 15, 2014 at 8:07 AM, Eric Winer &lt;enwiner at gmail.com&gt; wrote:&#xA;&#xA;&gt; I don&#39;t know for sure if the test vector is correct NFC form.  But for&#xA;&gt; what it&#39;s worth, the Pile of Poo character is pretty easily accessible on&#xA;&gt; the iPhone and Android keyboards, and in this string it&#39;s already in NFC&#xA;&gt; form (f09f92a9 in the test result).  I&#39;ve certainly seen it in usernames&#xA;&gt; around the internet, and wouldn&#39;t be surprised to see it in passphrases&#xA;&gt; entered on smartphones, especially if the author of a BIP38-compatible app&#xA;&gt; includes a (possibly ill-advised) suggestion to have your passphrase&#xA;&gt; &#34;include special characters&#34;.&#xA;&gt;&#xA;&gt; I haven&#39;t seen the NULL character on any smartphone keyboards, though - I&#xA;&gt; assume the iOS and Android developers had the foresight to know how much&#xA;&gt; havoc that would wreak on systems assuming null-terminated strings.  It&#xA;&gt; seems unlikely that NULL would be in a real-world passphrase entered by a&#xA;&gt; sane user.&#xA;&gt;&#xA;&gt;&#xA;&gt; On Tue, Jul 15, 2014 at 8:03 AM, Mike Hearn &lt;mike at plan99.net&gt; wrote:&#xA;&gt;&#xA;&gt;&gt; [+cc aaron]&#xA;&gt;&gt;&#xA;&gt;&gt; We recently added an implementation of BIP 38 (password protected private&#xA;&gt;&gt; keys) to bitcoinj. It came to my attention that the third test vector may&#xA;&gt;&gt; be broken. It gives a hex version of what the NFC normalised version of the&#xA;&gt;&gt; input string should be, but this does not match the results of the Java&#xA;&gt;&gt; unicode normaliser, and in fact I can&#39;t even get Python to print the names&#xA;&gt;&gt; of the characters past the embedded null. I&#39;m curious where this normalised&#xA;&gt;&gt; version came from.&#xA;&gt;&gt;&#xA;&gt;&gt; Given that &#34;pile of poo&#34; is not a character I think any sane user would&#xA;&gt;&gt; put into a passphrase, I question the value of this test vector. NFC form&#xA;&gt;&gt; is intended to collapse things like umlaut control characters onto their&#xA;&gt;&gt; prior code point, but here we&#39;re feeding the algorithm what is basically&#xA;&gt;&gt; garbage so I&#39;m not totally surprised that different implementations appear&#xA;&gt;&gt; to disagree on the outcome.&#xA;&gt;&gt;&#xA;&gt;&gt; Proposed action: we remove this test vector as it does not represent any&#xA;&gt;&gt; real world usage of the spec, or if we desperately need to verify NFC&#xA;&gt;&gt; normalisation I suggest using a different, more realistic test string, like&#xA;&gt;&gt; Zürich, or something written in Thai.&#xA;&gt;&gt;&#xA;&gt;&gt;&#xA;&gt;&gt;&#xA;&gt;&gt; Test 3:&#xA;&gt;&gt;&#xA;&gt;&gt;    - Passphrase ϓ␀𐐀💩 (\u03D2\u0301\u0000\U00010400\U0001F4A9; GREEK&#xA;&gt;&gt;    UPSILON WITH HOOK &lt;http://codepoints.net/U+03D2&gt;, COMBINING ACUTE&#xA;&gt;&gt;    ACCENT &lt;http://codepoints.net/U+0301&gt;, NULL&#xA;&gt;&gt;    &lt;http://codepoints.net/U+0000&gt;, DESERET CAPITAL LETTER LONG I&#xA;&gt;&gt;    &lt;http://codepoints.net/U+10400&gt;, PILE OF POO&#xA;&gt;&gt;    &lt;http://codepoints.net/U+1F4A9&gt;)&#xA;&gt;&gt;    - Encrypted key:&#xA;&gt;&gt;    6PRW5o9FLp4gJDDVqJQKJFTpMvdsSGJxMYHtHaQBF3ooa8mwD69bapcDQn&#xA;&gt;&gt;    - Bitcoin Address: 16ktGzmfrurhbhi6JGqsMWf7TyqK9HNAeF&#xA;&gt;&gt;    - Unencrypted private key (WIF):&#xA;&gt;&gt;    5Jajm8eQ22H3pGWLEVCXyvND8dQZhiQhoLJNKjYXk9roUFTMSZ4&#xA;&gt;&gt;    - *Note:* The non-standard UTF-8 characters in this passphrase should&#xA;&gt;&gt;    be NFC normalized to result in a passphrase of0xcf9300f0909080f09f92a9 before&#xA;&gt;&gt;    further processing&#xA;&gt;&gt;&#xA;&gt;&gt;&#xA;&gt;&gt;&#xA;&gt;&gt;&#xA;&gt;&gt;&#xA;&gt;&gt; ------------------------------------------------------------------------------&#xA;&gt;&gt; Want fast and easy access to all the code in your enterprise? Index and&#xA;&gt;&gt; search up to 200,000 lines of code with a free copy of Black Duck&#xA;&gt;&gt; Code Sight - the same software that powers the world&#39;s largest code&#xA;&gt;&gt; search on Ohloh, the Black Duck Open Hub! Try it now.&#xA;&gt;&gt; http://p.sf.net/sfu/bds&#xA;&gt;&gt; _______________________________________________&#xA;&gt;&gt; Bitcoin-development mailing list&#xA;&gt;&gt; Bitcoin-development at lists.sourceforge.net&#xA;&gt;&gt; https://lists.sourceforge.net/lists/listinfo/bitcoin-development&#xA;&gt;&gt;&#xA;&gt;&gt;&#xA;&gt;&#xA;&gt;&#xA;&gt; ------------------------------------------------------------------------------&#xA;&gt; Want fast and easy access to all the code in your enterprise? Index and&#xA;&gt; search up to 200,000 lines of code with a free copy of Black Duck&#xA;&gt; Code Sight - the same software that powers the world&#39;s largest code&#xA;&gt; search on Ohloh, the Black Duck Open Hub! Try it now.&#xA;&gt; http://p.sf.net/sfu/bds&#xA;&gt; _______________________________________________&#xA;&gt; Bitcoin-development mailing list&#xA;&gt; Bitcoin-development at lists.sourceforge.net&#xA;&gt; https://lists.sourceforge.net/lists/listinfo/bitcoin-development&#xA;&gt;&#xA;&gt;&#xA;-------------- next part --------------&#xA;An HTML attachment was scrubbed...&#xA;URL: &lt;http://lists.linuxfoundation.org/pipermail/bitcoin-dev/attachments/20140715/298353e5/attachment.html&gt;</html></oembed>