Title: Refactor EC key padding length lookup into shared cryptoECC helper; add BN-254 support by ljoy913 · Pull Request #27 · microsoft/MSR-JavaScript-Crypto · GitHub
Open Graph Title: Refactor EC key padding length lookup into shared cryptoECC helper; add BN-254 support by ljoy913 · Pull Request #27 · microsoft/MSR-JavaScript-Crypto
X Title: Refactor EC key padding length lookup into shared cryptoECC helper; add BN-254 support by ljoy913 · Pull Request #27 · 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. Rebuilt distribution bundle Regenerated dist/msrcrypto.js and dist/msrcrypto.min.js so the published bundle includes the fix. 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/27
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:33937b95-ce24-f2b8-4ad9-00af4794f9f4 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | C606:2B1453:10A9DBF:16BB26B:6A61AF24 |
| html-safe-nonce | b790441376d0224947444e7492555321740006e09b664f1348bab917b44f102c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNjA2OjJCMTQ1MzoxMEE5REJGOjE2QkIyNkI6NkE2MUFGMjQiLCJ2aXNpdG9yX2lkIjoiMjAzMjE2MjYwOTY1NjA4MjIxMiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | b1a07bc3df08e885866526c828409888202d78e2aa116f2193923b1b9c47a3ac |
| hovercard-subject-tag | pull_request:3950950675 |
| 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/27/files |
| twitter:image | https://avatars.githubusercontent.com/u/24281027?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/24281027?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 | 6f4633bcf01c1ad14b73fd07dd39ac31d61f3d3c2578ee08ec1792b7b351eeb9 |
| 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 | ac296ae7f21856f1f92adbad22f870b6fbb4b907 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width