cryptojs-rails 2.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 0a00a236af905537cc3771e137ea7c8a67f28451
4
+ data.tar.gz: f889d47ceb0ed79ee15fae73720fc46c475252a3
5
+ SHA512:
6
+ metadata.gz: eda162ee0f7acff0bbade1ddaecdc6ce737ba7794715698879610ab0ca2893e627ffdb92607d8661e6914a599d0fd3b0acda5bc4b83df1a83743bc6eaf82248b
7
+ data.tar.gz: b4f785f63ce8ae3afae8ff03bb0b8ebc271040e230f7ab4f4e9c1422d8257b0544e2e2eaf3b4b8e54685934d0e136f49a520a8eb169a32a16b2371409279a103
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 Eric Bouchut
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,52 @@
1
+ # cryptojs-rails
2
+
3
+ [CryptoJS][crypto-js] is a growing collection
4
+ of standard and secure cryptographic algorithms implemented in JavaScript,
5
+ using best practices and patterns.
6
+ They are fast, and they have a consistent and simple interface.
7
+
8
+ This gem allows for its inclusion into the Rails asset pipeline.
9
+
10
+
11
+ ## Installation
12
+
13
+ Add this line to your application's Gemfile:
14
+
15
+ ```ruby
16
+ gem 'cryptojs-rails'
17
+ ```
18
+
19
+ And then execute:
20
+
21
+ $ bundle
22
+
23
+ Or install it yourself as:
24
+
25
+ $ gem install cryptojs-rails
26
+
27
+
28
+ ## Usage
29
+
30
+ Add this line to your application.js:
31
+
32
+ //= require crypto
33
+
34
+
35
+ ## Versioning
36
+
37
+ `cryptojs-rails 2.5.3 == crypto-js 2.5.3`
38
+
39
+ Every attempt is made to mirror the currently shipping [crypto-js][crypto-js] version number wherever possible. The major, minor, and patch version numbers will always represent the crypto-js version.
40
+ Should a gem bug be discovered, a 4th version identifier will be added and incremented.
41
+
42
+
43
+ ## Contributing
44
+
45
+ 1. Fork it ( https://github.com/[my-github-username]/cryptojs-rails/fork )
46
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
47
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
48
+ 4. Push to the branch (`git push origin my-new-feature`)
49
+ 5. Create a new Pull Request
50
+
51
+
52
+ [crypto-js]: https://code.google.com/p/crypto-js/ "crypto-js"
@@ -0,0 +1,160 @@
1
+ /*
2
+ * Crypto-JS v2.5.3
3
+ * http://code.google.com/p/crypto-js/
4
+ * (c) 2009-2012 by Jeff Mott. All rights reserved.
5
+ * http://code.google.com/p/crypto-js/wiki/License
6
+ */
7
+ if (typeof Crypto == "undefined" || ! Crypto.util)
8
+ {
9
+ (function(){
10
+
11
+ var base64map = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
12
+
13
+ // Global Crypto object
14
+ var Crypto = window.Crypto = {};
15
+
16
+ // Crypto utilities
17
+ var util = Crypto.util = {
18
+
19
+ // Bit-wise rotate left
20
+ rotl: function (n, b) {
21
+ return (n << b) | (n >>> (32 - b));
22
+ },
23
+
24
+ // Bit-wise rotate right
25
+ rotr: function (n, b) {
26
+ return (n << (32 - b)) | (n >>> b);
27
+ },
28
+
29
+ // Swap big-endian to little-endian and vice versa
30
+ endian: function (n) {
31
+
32
+ // If number given, swap endian
33
+ if (n.constructor == Number) {
34
+ return util.rotl(n, 8) & 0x00FF00FF |
35
+ util.rotl(n, 24) & 0xFF00FF00;
36
+ }
37
+
38
+ // Else, assume array and swap all items
39
+ for (var i = 0; i < n.length; i++)
40
+ n[i] = util.endian(n[i]);
41
+ return n;
42
+
43
+ },
44
+
45
+ // Generate an array of any length of random bytes
46
+ randomBytes: function (n) {
47
+ for (var bytes = []; n > 0; n--)
48
+ bytes.push(Math.floor(Math.random() * 256));
49
+ return bytes;
50
+ },
51
+
52
+ // Convert a byte array to big-endian 32-bit words
53
+ bytesToWords: function (bytes) {
54
+ for (var words = [], i = 0, b = 0; i < bytes.length; i++, b += 8)
55
+ words[b >>> 5] |= (bytes[i] & 0xFF) << (24 - b % 32);
56
+ return words;
57
+ },
58
+
59
+ // Convert big-endian 32-bit words to a byte array
60
+ wordsToBytes: function (words) {
61
+ for (var bytes = [], b = 0; b < words.length * 32; b += 8)
62
+ bytes.push((words[b >>> 5] >>> (24 - b % 32)) & 0xFF);
63
+ return bytes;
64
+ },
65
+
66
+ // Convert a byte array to a hex string
67
+ bytesToHex: function (bytes) {
68
+ for (var hex = [], i = 0; i < bytes.length; i++) {
69
+ hex.push((bytes[i] >>> 4).toString(16));
70
+ hex.push((bytes[i] & 0xF).toString(16));
71
+ }
72
+ return hex.join("");
73
+ },
74
+
75
+ // Convert a hex string to a byte array
76
+ hexToBytes: function (hex) {
77
+ for (var bytes = [], c = 0; c < hex.length; c += 2)
78
+ bytes.push(parseInt(hex.substr(c, 2), 16));
79
+ return bytes;
80
+ },
81
+
82
+ // Convert a byte array to a base-64 string
83
+ bytesToBase64: function (bytes) {
84
+
85
+ // Use browser-native function if it exists
86
+ if (typeof btoa == "function") return btoa(Binary.bytesToString(bytes));
87
+
88
+ for(var base64 = [], i = 0; i < bytes.length; i += 3) {
89
+ var triplet = (bytes[i] << 16) | (bytes[i + 1] << 8) | bytes[i + 2];
90
+ for (var j = 0; j < 4; j++) {
91
+ if (i * 8 + j * 6 <= bytes.length * 8)
92
+ base64.push(base64map.charAt((triplet >>> 6 * (3 - j)) & 0x3F));
93
+ else base64.push("=");
94
+ }
95
+ }
96
+
97
+ return base64.join("");
98
+
99
+ },
100
+
101
+ // Convert a base-64 string to a byte array
102
+ base64ToBytes: function (base64) {
103
+
104
+ // Use browser-native function if it exists
105
+ if (typeof atob == "function") return Binary.stringToBytes(atob(base64));
106
+
107
+ // Remove non-base-64 characters
108
+ base64 = base64.replace(/[^A-Z0-9+\/]/ig, "");
109
+
110
+ for (var bytes = [], i = 0, imod4 = 0; i < base64.length; imod4 = ++i % 4) {
111
+ if (imod4 == 0) continue;
112
+ bytes.push(((base64map.indexOf(base64.charAt(i - 1)) & (Math.pow(2, -2 * imod4 + 8) - 1)) << (imod4 * 2)) |
113
+ (base64map.indexOf(base64.charAt(i)) >>> (6 - imod4 * 2)));
114
+ }
115
+
116
+ return bytes;
117
+
118
+ }
119
+
120
+ };
121
+
122
+ // Crypto character encodings
123
+ var charenc = Crypto.charenc = {};
124
+
125
+ // UTF-8 encoding
126
+ var UTF8 = charenc.UTF8 = {
127
+
128
+ // Convert a string to a byte array
129
+ stringToBytes: function (str) {
130
+ return Binary.stringToBytes(unescape(encodeURIComponent(str)));
131
+ },
132
+
133
+ // Convert a byte array to a string
134
+ bytesToString: function (bytes) {
135
+ return decodeURIComponent(escape(Binary.bytesToString(bytes)));
136
+ }
137
+
138
+ };
139
+
140
+ // Binary encoding
141
+ var Binary = charenc.Binary = {
142
+
143
+ // Convert a string to a byte array
144
+ stringToBytes: function (str) {
145
+ for (var bytes = [], i = 0; i < str.length; i++)
146
+ bytes.push(str.charCodeAt(i) & 0xFF);
147
+ return bytes;
148
+ },
149
+
150
+ // Convert a byte array to a string
151
+ bytesToString: function (bytes) {
152
+ for (var str = [], i = 0; i < bytes.length; i++)
153
+ str.push(String.fromCharCode(bytes[i]));
154
+ return str.join("");
155
+ }
156
+
157
+ };
158
+
159
+ })();
160
+ }
@@ -0,0 +1,8 @@
1
+ require "cryptojs-rails/version"
2
+
3
+ module Cryptojs
4
+ module Rails
5
+ class Engine < ::Rails::Engine
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,5 @@
1
+ module Cryptojs
2
+ module Rails
3
+ VERSION = "2.5.3"
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,80 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cryptojs-rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.5.3
5
+ platform: ruby
6
+ authors:
7
+ - Eric Bouchut
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-02-09 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: railties
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '4.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '4.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: 1.0.0
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: 1.0.0
41
+ description: |-
42
+ CryptoJS is a growing collection of standard and secure cryptographic algorithms implemented in JavaScript using best practices and patterns.
43
+ They are fast, and they have a consistent and simple interface.
44
+ This gem allows for its inclusion into the Rails asset pipeline.
45
+ email:
46
+ - ebouchut@gmail.com
47
+ executables: []
48
+ extensions: []
49
+ extra_rdoc_files: []
50
+ files:
51
+ - lib/cryptojs-rails/version.rb
52
+ - lib/cryptojs-rails.rb
53
+ - app/assets/javascripts/crypto.js
54
+ - LICENSE
55
+ - README.md
56
+ homepage: https://github.com/ebouchut/cryptojs-rails
57
+ licenses:
58
+ - MIT
59
+ metadata: {}
60
+ post_install_message:
61
+ rdoc_options: []
62
+ require_paths:
63
+ - lib
64
+ required_ruby_version: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ required_rubygems_version: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - '>='
72
+ - !ruby/object:Gem::Version
73
+ version: '0'
74
+ requirements: []
75
+ rubyforge_project:
76
+ rubygems_version: 2.0.14
77
+ signing_key:
78
+ specification_version: 4
79
+ summary: The CryptoJS JavaScript library packaged as a gem for Rails.
80
+ test_files: []