fastlib 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +33 -2
- data/lib/fastlib.rb +17 -8
- metadata +3 -3
data/README.markdown
CHANGED
@@ -8,9 +8,40 @@ This is similar to capabilities like zip/ziprequire, except that it provides wor
|
|
8
8
|
|
9
9
|
$ apt-get install fastlib
|
10
10
|
|
11
|
-
|
11
|
+
## Store a library structure into FASTLIB archive
|
12
|
+
$ \`gem env gemdir\`/gems/fastlib-\*/lib/fastlib.rb store 00000000 myarchive.fastlib lib/ lib/\*
|
13
|
+
$ rm -rf lib
|
12
14
|
|
13
|
-
|
15
|
+
## Use that archive just by including the containing directory
|
16
|
+
$ ruby -r rubygems -r fastlib -I. ./app.rb
|
17
|
+
|
18
|
+
## Store a library structure into a FASTLIB archive with compression
|
19
|
+
$ \`gem env gemdir\`/gems/fastlib-\*/lib/fastlib.rb store 00000001 myarchive.fastlib lib/ lib/\*
|
20
|
+
|
21
|
+
## Store a library structure into a FASTLIB archive with default "encryption"
|
22
|
+
$ \`gem env gemdir\`/gems/fastlib-\*/lib/fastlib.rb store 00000002 myarchive.fastlib lib/ lib/\*
|
23
|
+
|
24
|
+
## Store a library structure into a FASTLIB archive with default "encryption" and compression
|
25
|
+
$ \`gem env gemdir\`/gems/fastlib-\*/lib/fastlib.rb store 00000003 myarchive.fastlib lib/ lib/\*
|
26
|
+
|
27
|
+
## Store a library structure into a FASTLIB archive with custom encryption and compression
|
28
|
+
$ ruby -I . -r mycrypto.rb \`gem env gemdir\`/gems/fastlib-\*/lib/fastlib.rb store 13370003 myarchive.fastlib lib/ lib/\*
|
29
|
+
|
30
|
+
$ cat mycrypto.rb
|
31
|
+
|
32
|
+
require 'openssl'
|
33
|
+
|
34
|
+
class FastLib
|
35
|
+
|
36
|
+
def self.encrypt_13370000(data)
|
37
|
+
# Encrypt
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.decrypt_13370000(data)
|
41
|
+
# Decrypt
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
14
45
|
|
15
46
|
|
16
47
|
# Credits
|
data/lib/fastlib.rb
CHANGED
@@ -37,7 +37,7 @@ require "find"
|
|
37
37
|
#
|
38
38
|
class FastLib
|
39
39
|
|
40
|
-
VERSION = "0.0.
|
40
|
+
VERSION = "0.0.7"
|
41
41
|
|
42
42
|
FLAG_COMPRESS = 0x01
|
43
43
|
FLAG_ENCRYPT = 0x02
|
@@ -249,22 +249,31 @@ class FastLib
|
|
249
249
|
|
250
250
|
#
|
251
251
|
# This is a stub crypto handler that performs a basic XOR
|
252
|
-
# operation against a fixed one byte key
|
252
|
+
# operation against a fixed one byte key. The two usable IDs
|
253
|
+
# are 12345600 and 00000000
|
253
254
|
#
|
254
255
|
def self.encrypt_12345600(data)
|
255
|
-
data
|
256
|
+
encrypt_00000000(data)
|
256
257
|
end
|
257
258
|
|
258
259
|
def self.decrypt_12345600(data)
|
259
|
-
|
260
|
+
encrypt_00000000(data)
|
260
261
|
end
|
261
262
|
|
262
|
-
def self.
|
263
|
-
|
263
|
+
def self.encrypt_00000000(data)
|
264
|
+
data.unpack("C*").map{ |c| c ^ 0x90 }.pack("C*")
|
264
265
|
end
|
265
266
|
|
266
|
-
|
267
|
-
|
267
|
+
def self.decrypt_00000000(data)
|
268
|
+
encrypt_00000000(data)
|
269
|
+
end
|
270
|
+
|
271
|
+
#
|
272
|
+
# Expose the cache to callers
|
273
|
+
#
|
274
|
+
def self.cache
|
275
|
+
@@cache
|
276
|
+
end
|
268
277
|
end
|
269
278
|
|
270
279
|
|
metadata
CHANGED