Title: Refactor EC key padding length lookup into shared cryptoECC helper; add BN-254 support by Copilot · Pull Request #26 · microsoft/MSR-JavaScript-Crypto · GitHub
Open Graph Title: Refactor EC key padding length lookup into shared cryptoECC helper; add BN-254 support by Copilot · Pull Request #26 · microsoft/MSR-JavaScript-Crypto
X Title: Refactor EC key padding length lookup into shared cryptoECC helper; add BN-254 support by Copilot · Pull Request #26 · microsoft/MSR-JavaScript-Crypto
Description: PR #25’s leading-zero padding logic introduced four duplicated curve-length tables in ECDH/ECDSA, and all four omitted BN-254. This change consolidates curve element-length resolution into a single shared source and makes lookups case-insensitive to avoid drift and mismatches. Shared curve element-length source in cryptoECC Added curveElementLengths in src/cryptoECC.js with the full supported set, including "BN-254": 32. Added/exported cryptoECC.curveElementLength(curveName) to normalize via toUpperCase() and return the fixed element byte length. Replaced duplicated partLen tables (4 call sites) src/ecdh.js generateKey importKey (p.format === "jwk") src/ecdsa.js generateKey importKey (p.format === "jwk") Each now reads from cryptoECC.curveElementLength(...) instead of inline object literals. Targeted BN-254 coverage updates in existing ECC tests Added BN-254 key-generation test cases in test/Test.Ecdh.js and test/Test.Ecdsa.js. Updated test key-length checks to use cryptoECC.curveElementLength(...) directly instead of duplicated ecdhKeyLengths / ecdsaKeyLengths tables. Example of the lookup change: // before var partLen = { "P-256": 32, "P-384": 48, "P-521": 66, "NUMSP256D1": 32, "NUMSP256T1": 32, "NUMSP384D1": 48, "NUMSP384T1": 48, "NUMSP512D1": 64, "NUMSP512T1": 64 }[p.algorithm.namedCurve]; // after var partLen = cryptoECC.curveElementLength(p.algorithm.namedCurve);
Open Graph Description: PR #25’s leading-zero padding logic introduced four duplicated curve-length tables in ECDH/ECDSA, and all four omitted BN-254. This change consolidates curve element-length resolution into a single...
X Description: PR #25’s leading-zero padding logic introduced four duplicated curve-length tables in ECDH/ECDSA, and all four omitted BN-254. This change consolidates curve element-length resolution into a single...
Opengraph URL: https://github.com/microsoft/MSR-JavaScript-Crypto/pull/26
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:21119f1b-c1c0-94bf-cde0-027968a48e00 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 8A30:C1A48:5975B2:79070B:6A629FDD |
| html-safe-nonce | 4bfe46aba85348261911fd78d37f897f655be1f7962643f9b1268e6db8952c5a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4QTMwOkMxQTQ4OjU5NzVCMjo3OTA3MEI6NkE2MjlGREQiLCJ2aXNpdG9yX2lkIjoiMjYxNzA1MDI2Mzg4Nzk3ODQ2MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 0bb45099f4b588ac37be55b9c78c8cd5898cd89a51ec8534c95ab1a5018b810a |
| hovercard-subject-tag | pull_request:3948491120 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/microsoft/MSR-JavaScript-Crypto/pull/26/files |
| twitter:image | https://avatars.githubusercontent.com/in/1143301?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/in/1143301?s=400&v=4 |
| og:image:alt | PR #25’s leading-zero padding logic introduced four duplicated curve-length tables in ECDH/ECDSA, and all four omitted BN-254. This change consolidates curve element-length resolution into a single... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | a6443033349a18134b517627f043d4a59a5110337b879810c7229c2c7e28eda0 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/microsoft/MSR-JavaScript-Crypto git https://github.com/microsoft/MSR-JavaScript-Crypto.git |
| octolytics-dimension-user_id | 6154722 |
| octolytics-dimension-user_login | microsoft |
| octolytics-dimension-repository_id | 198688283 |
| octolytics-dimension-repository_nwo | microsoft/MSR-JavaScript-Crypto |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 198688283 |
| octolytics-dimension-repository_network_root_nwo | microsoft/MSR-JavaScript-Crypto |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | d6c6cacbe32d3ddfd1796fbd1a39b8fb47b87daf |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width