Title: crypto: getDecoder throws "AssertionError: Cannot change encoding" when encoding is "ucs2", "ucs-2" or "utf-16le". · Issue #8236 · nodejs/node · GitHub
Open Graph Title: crypto: getDecoder throws "AssertionError: Cannot change encoding" when encoding is "ucs2", "ucs-2" or "utf-16le". · Issue #8236 · nodejs/node
X Title: crypto: getDecoder throws "AssertionError: Cannot change encoding" when encoding is "ucs2", "ucs-2" or "utf-16le". · Issue #8236 · nodejs/node
Description: v6.3.0: Windows 64-bit: I've got similar issue as: #5655 when I'm using as output encoding 'ucs2', 'usc-2' or 'utf-16le'. If I'm using 'utf16le' the code works. Here is the not working code: var decrypted = decipher.update(value, 'base64...
Open Graph Description: v6.3.0: Windows 64-bit: I've got similar issue as: #5655 when I'm using as output encoding 'ucs2', 'usc-2' or 'utf-16le'. If I'm using 'utf16le' the code works. Here is the not working code: var de...
X Description: v6.3.0: Windows 64-bit: I've got similar issue as: #5655 when I'm using as output encoding 'ucs2', 'usc-2' or 'utf-16le'. If I'm using 'utf16le' the code...
Opengraph URL: https://github.com/nodejs/node/issues/8236
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"crypto: getDecoder throws \"AssertionError: Cannot change encoding\" when encoding is \"ucs2\", \"ucs-2\" or \"utf-16le\".","articleBody":"- **v6.3.0**:\n- **Windows 64-bit**:\n\nI've got similar issue as:\n[#5655](https://github.com/nodejs/node-v0.x-archive/issues/5655)\nwhen I'm using as output encoding 'ucs2', 'usc-2' or 'utf-16le'. If I'm using 'utf16le' the code works.\n\nHere is the not working code:\n`var decrypted = decipher.update(value, 'base64', 'usc2');`\n\nOutput:\n\n`Stack:\n AssertionError: Cannot change encoding\n at getDecoder (crypto.js:105:3)\n at Decipheriv.Cipher.update (crypto.js:146:21)`\n\nand here the working one:\n`var decrypted = decipher.update(value, 'base64', 'utf16le');`\n\n[According to the documentation:](https://nodejs.org/api/crypto.html#crypto_decipher_update_data_input_encoding_output_encoding)\n\n\u003e The output_encoding specifies the output format of the enciphered data, and can be 'latin1', 'ascii' or 'utf8'.\n\nthe utf16le is not supported as output encoding, but it works if you specify 'utf16le'.\n\nThe change in [lib/crypto.js](https://github.com/nodejs/node/blob/master/lib/crypto.js#L104) fix the issue with utf-8, but not with utf-16le.\nThere is a function 'normalizeEncoding' in [lib/internal/util.js](https://github.com/nodejs/node/blob/master/lib/internal/util.js#L109) that can be used to normalize the encoding.\n","author":{"url":"https://github.com/atstoyanov","@type":"Person","name":"atstoyanov"},"datePublished":"2016-08-23T13:17:57.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/8236/node/issues/8236"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:655b2a9f-3d76-4144-2bf9-13461dea755f |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B944:18AAA8:1EC8ECE:2A1FB09:6A5414C1 |
| html-safe-nonce | 1e24eba5e3eab840e95b9fa69ae3fc2db26e00ab70fb81f879266f49c318e067 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCOTQ0OjE4QUFBODoxRUM4RUNFOjJBMUZCMDk6NkE1NDE0QzEiLCJ2aXNpdG9yX2lkIjoiODY3MjcwNDY4NTUzNjc1OTY5IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 2fe1f404f34f37353666753dae242f6ffb6b4c9681a03c4163db1b60220ec99b |
| hovercard-subject-tag | issue:172696427 |
| github-keyboard-shortcuts | repository,issues,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/_view_fragments/issues/show/nodejs/node/8236/issue_layout |
| twitter:image | https://opengraph.githubassets.com/dba8ec935094999160c50de931f1a9fc0ccb6f73c61c238a321ae039685a3dc7/nodejs/node/issues/8236 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/dba8ec935094999160c50de931f1a9fc0ccb6f73c61c238a321ae039685a3dc7/nodejs/node/issues/8236 |
| og:image:alt | v6.3.0: Windows 64-bit: I've got similar issue as: #5655 when I'm using as output encoding 'ucs2', 'usc-2' or 'utf-16le'. If I'm using 'utf16le' the code works. Here is the not working code: var de... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | atstoyanov |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| turbo-cache-control | no-preview |
| go-import | github.com/nodejs/node git https://github.com/nodejs/node.git |
| octolytics-dimension-user_id | 9950313 |
| octolytics-dimension-user_login | nodejs |
| octolytics-dimension-repository_id | 27193779 |
| octolytics-dimension-repository_nwo | nodejs/node |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 27193779 |
| octolytics-dimension-repository_network_root_nwo | nodejs/node |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 07a982c1d40157c619b364352b704c3ce66bb332 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width