Comments (4)
It is, but you have to wrap the root cryptojs file as described here
from cryptojs.
Thanks for that, I ended up doing something like this:
This is for AES module.
require.config({
modules: [
{
name: 'main'
}
],
paths: {
'crypto': "../components/cryptojs/lib/Crypto",
'crypto.BlockModes': "../components/cryptojs/lib/BlockModes",
'crypto.PBKDF2': "../components/cryptojs/lib/PBKDF2",
'crypto.HMAC': "../components/cryptojs/lib/HMAC",
'crypto.SHA1': "../components/cryptojs/lib/SHA1",
'crypto.AES': "../components/cryptojs/lib/AES"
},
shim: {
'crypto.AES': ['crypto','crypto.BlockModes','crypto.PBKDF2','crypto.HMAC','crypto.SHA1']
}
});
require([
'crypto.AES'
], function () {
Crypto.AES.encrypt('password', 'passphrase');
});
from cryptojs.
are you sure there aren't changes that could be made to this that could make it simply work by using packages support in requirejs http://requirejs.org/docs/api.html#packages ? without breaking commonjs support?
from cryptojs.
paths: {
'crypto' :'/bower_components/cryptojs/lib/Crypto',
'crypto.MD5' :'/bower_components/cryptojs/lib/MD5',
},
shim: {
'crypto.MD5' :['crypto'],
},
// ... in my controller module (note:angular bits are simply to give such users an idea
define(['crypto.MD5', 'angular'], function() { return [ '$scope', function ( $scope ) {
var digest = Crypto.MD5( $scope.code ).toString();
}];
});
I think it's probably important not to try to use Crypto
in the "requirejs name" because it will override the global name export or somethin'. Also usage is based on that global name not the require name.
from cryptojs.
Related Issues (13)
- Offer to help with maintenance
- This project is not updated for 2 years
- Javascript sample code
- Add a license
- Unexpected String when requiring
- RangeError: Invalid array length HOT 10
- can not import in react-native
- TypeError: Cannot read property 'decrypt' of undefined
- Functionality doesn't match CyrptoJS, no documented alternative HOT 5
- Where is RC4 support? HOT 3
- Does not work in the browser so don't claim it...... HOT 1
- Examples are not in Javascript
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 cryptojs.