Comments (7)
Even more, this prevents us from not using 'unsafe-eval' in our Content Security Policy. Any chance that this one get fixed?
from js-sha256.
Can it be changed to a dynamic import or anything along those lines to avoid the use of eval()
?
from js-sha256.
It also breaks in vitejs. We need a fix.
from js-sha256.
remove eval in v0.10.0
from js-sha256.
This is because emn178/js-md5#8
And I found it won't polyfill unused code in this way.
from js-sha256.
As a fix, you can replace the eval strings in the library during build.
In rollup.config.js
:
import replace from "rollup-plugin-re";
export default {
...,
plugins: [
replace({
patterns: [
{
match: /js-sha256/,
test: `eval("require('crypto')")`,
replace: `require('crypto')`
},
{
match: /js-sha256/,
test: `eval("require('buffer').Buffer")`,
replace: `require('buffer').Buffer`
}
],
}),
]
}
from js-sha256.
An alternative to suppress warnings in vite.config.js
:
export default defineConfig({
build: {
rollupOptions: {
onwarn: ({ loc }) => {
if (loc?.file?.match(/js-sha256\/src\/sha256.js$/))
return;
}
}
});
from js-sha256.
Related Issues (20)
- Crypto not found in React Native HOT 4
- Different Result with sha256.hmac HOT 1
- Conflict with requirejs HOT 11
- Hmac update question HOT 2
- Outdated typescript definition HOT 6
- Using Salt HOT 1
- Example for File Hash SHA256 ? HOT 1
- One of the test cases for HMAC is "wrong" HOT 1
- Library does not work under strict Content-Security-Policy HOT 2
- Different output on online-tools and while using the lib HOT 2
- How fast is it compared to native ? HOT 3
- When will the version be updated? How often is the update? HOT 3
- How to decrypt HOT 4
- 同学,您这个项目引入了22个开源组件,存在3个漏洞,辛苦升级一下 HOT 1
- Deprecate library and reccomend standardized APIs HOT 12
- Google Chrome 115.0.5790.102 produces incorrect SHA-256 hashes HOT 21
- Sha256
- Generates incorrect hash in some cases HOT 2
- Vend ESM Please
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from js-sha256.