Skip to content

Commit

Permalink
n17
Browse files Browse the repository at this point in the history
  • Loading branch information
s50600822 committed Feb 8, 2024
1 parent 07893eb commit 8991f37
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 0 deletions.
35 changes: 35 additions & 0 deletions vs/node/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
### References

- [Reddit - Node 17 currently breaks most Webpack](https://www.reddit.com/r/webdev/comments/qd14bm/node_17_currently_breaks_most_webpack/)
- [Webpack Hashed Module IDs Plugin](https://webpack.js.org/plugins/hashed-module-ids-plugin/)
- [Angular CLI GitHub Issue #1656](https://github.com/angular/angular-cli/issues/1656)
- [Stack Overflow - Error Message: error:0308010C:digital envelope routines:unsupported](https://stackoverflow.com/questions/69692842/error-message-error0308010cdigital-envelope-routinesunsupported)
- [Node.js Blog - OpenSSL November 2022 Vulnerability](https://nodejs.org/en/blog/vulnerability/openssl-november-2022)
- [Node.js GitHub Pull Request #40478](https://github.com/nodejs/node/pull/40478)
- [Node.js GitHub Issue #40455](https://github.com/nodejs/node/issues/40455)
- [Webpack.js.org config](https://github.com/webpack/webpack.js.org/commit/5a81c718d470cd4e82f177a5bd099164f4c6f7e9#diff-154021c8c1ce914c5be753b5667e4e615d0edfcb0874240c4fbf72a6424c7e65)


### Webpack


`webpack.config.js`
```javascript

module.exports = {
output: {
//https://webpack.js.org/configuration/output/#outputhashdigest
hashFunction: 'sha256'
},
};
```
OR xxhash64 as default by:

`webpack.config.js`
```javascript
module.exports = {
experiments: {
futureDefaults: true,
},
};
```
15 changes: 15 additions & 0 deletions vs/node/hash.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
const crypto = require('crypto');

function generateHash(data, algo) {
const hash = crypto.createHash(algo);
hash.update(data);
const hashedData = hash.digest('hex');

return hashedData;
}

const testData = 'Hello, World!';
const hashedData = generateHash(testData, "md4");//"md5", "sha256", "sha512" ... are fine.

console.log('Original Data:', testData);
console.log('Hash:', hashedData);
7 changes: 7 additions & 0 deletions vs/node/n16_fine.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
NODE_VERSION=v16.20.2

source /Users/hoaphan/.nvm/nvm.sh
nvm install $NODE_VERSION
nvm use $NODE_VERSION

node hash.js
7 changes: 7 additions & 0 deletions vs/node/n17_broken.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
NODE_VERSION=v17.0.0

source /Users/hoaphan/.nvm/nvm.sh
nvm install $NODE_VERSION
nvm use $NODE_VERSION

node hash.js
7 changes: 7 additions & 0 deletions vs/node/n17_unadvisible.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
NODE_VERSION=v17.0.0

source /Users/hoaphan/.nvm/nvm.sh
nvm install $NODE_VERSION
nvm use $NODE_VERSION

node --openssl-legacy-provider hash.js

0 comments on commit 8991f37

Please sign in to comment.