Permalink
Browse files

make js files worked on npm module structure

  • Loading branch information...
1 parent e209212 commit 20b6ff5ddc02d116c9ab942f1e41f15350a2ff0d @gwjjeff committed Jan 13, 2012
View
@@ -67,7 +67,7 @@ EOLINES
# write readme for github
cat > README.md <<\EOLINES
-* with little modification, converted from googlecode project "crypto-js":http://code.google.com/p/crypto-js/
+* with little modification, converted from googlecode project "crypto-js":http://code.google.com/p/crypto-js/ , and keep the source code structure of the origin project on googlecode
* source code worked in both browser engines and node scripts. see also: "https://github.com/gwjjeff/crypto-js-npm-conv":https://github.com/gwjjeff/crypto-js-npm-conv
* inspiration comes from "ezcrypto":https://github.com/ElmerZhang/ezcrypto , but my tests cannot pass with his version ( ECB/pkcs7 mode ), so I made it myself
View
@@ -1,4 +1,6 @@
-(function(C){
+(function(){
+
+var C = (typeof window === 'undefined') ? require('./Crypto').Crypto : window.Crypto;
// Shortcuts
var util = C.util,
@@ -397,4 +399,4 @@ var AES = C.AES = {
};
-})(Crypto);
+})();
@@ -2,7 +2,9 @@
* Crypto-JS contribution from Simon Greatrix
*/
-(function(C){
+(function(){
+
+var C = (typeof window === 'undefined') ? require('./Crypto').Crypto : window.Crypto;
// Create pad namespace
var C_pad = C.pad = {};
@@ -373,4 +375,4 @@ CTR_prototype._doEncrypt = function (cipher, m, iv) {
};
CTR_prototype._doDecrypt = CTR_prototype._doEncrypt;
-})(Crypto);
+})();
@@ -1,4 +1,6 @@
-(function(C){
+(function(){
+
+var C = (typeof window === 'undefined') ? require('./Crypto').Crypto : window.Crypto;
// Shortcut
var util = C.util;
@@ -32,4 +34,4 @@ util.lt = function (m, n) {
return this.u32(m) < this.u32(n);
};
-})(Crypto);
+})();
View
@@ -3,7 +3,9 @@
* http://www.itl.nist.gov/fipspubs/fip46-2.htm
*/
-(function(C) {
+(function() {
+
+var C = (typeof window === 'undefined') ? require('./Crypto').Crypto : window.Crypto;
// Shortcuts
var util = C.util, charenc = C.charenc, UTF8 = charenc.UTF8;
@@ -998,4 +1000,4 @@
}
};
-})(Crypto);
+})();
@@ -1,4 +1,6 @@
-(function(C){
+(function(){
+
+var C = (typeof window === 'undefined') ? require('./Crypto').Crypto : window.Crypto;
// Shortcuts
var util = C.util,
@@ -33,4 +35,4 @@ C.HMAC = function (hasher, message, key, options) {
};
-})(Crypto);
+})();
@@ -1,4 +1,6 @@
-(function(C){
+(function(){
+
+var C = (typeof window === 'undefined') ? require('./Crypto').Crypto : window.Crypto;
// Shortcuts
var util = C.util,
@@ -112,4 +114,4 @@ var MARC4 = C.MARC4 = {
};
-})(Crypto);
+})();
View
@@ -1,4 +1,6 @@
-(function(C){
+(function(){
+
+var C = (typeof window === 'undefined') ? require('./Crypto').Crypto : window.Crypto;
// Shortcuts
var util = C.util,
@@ -153,4 +155,4 @@ MD5._blocksize = 16;
MD5._digestsize = 16;
-})(Crypto);
+})();
@@ -1,4 +1,6 @@
-(function(C){
+(function(){
+
+var C = (typeof window === 'undefined') ? require('./Crypto').Crypto : window.Crypto;
// Shortcuts
var util = C.util,
@@ -44,4 +46,4 @@ C.PBKDF2 = function (password, salt, keylen, options) {
};
-})(Crypto);
+})();
@@ -1,4 +1,6 @@
-(function(C){
+(function(){
+
+var C = (typeof window === 'undefined') ? require('./Crypto').Crypto : window.Crypto;
// Shortcuts
var util = C.util,
@@ -83,4 +85,4 @@ C.PBKDF2Async = function (password, salt, keylen, callback, options) {
});
};
-})(Crypto);
+})();
@@ -1,4 +1,6 @@
-(function(C){
+(function(){
+
+var C = (typeof window === 'undefined') ? require('./Crypto').Crypto : window.Crypto;
// Shortcuts
var util = C.util,
@@ -216,4 +218,4 @@ var Rabbit = C.Rabbit = {
};
-})(Crypto);
+})();
@@ -1,4 +1,6 @@
-(function(C){
+(function(){
+
+var C = (typeof window === 'undefined') ? require('./Crypto').Crypto : window.Crypto;
// Shortcuts
var util = C.util,
@@ -81,4 +83,4 @@ SHA1._blocksize = 16;
SHA1._digestsize = 20;
-})(Crypto);
+})();
@@ -1,4 +1,6 @@
-(function(C){
+(function(){
+
+var C = (typeof window === 'undefined') ? require('./Crypto').Crypto : window.Crypto;
// Shortcuts
var util = C.util,
@@ -125,4 +127,4 @@ SHA256._blocksize = 16;
SHA256._digestsize = 32;
-})(Crypto);
+})();

0 comments on commit 20b6ff5

Please sign in to comment.