fastlib 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/README.markdown +33 -2
  2. data/lib/fastlib.rb +17 -8
  3. metadata +3 -3
@@ -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
- $ \`gem env gemdir\`/gems/fastlib-\*/lib/fastlib.rb dump lib/myarchive.fastlib lib/ lib/\*
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
- $ ruby -r rubygems -r fastlib -I lib/myarchive.fastlib application.rb
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
@@ -37,7 +37,7 @@ require "find"
37
37
  #
38
38
  class FastLib
39
39
 
40
- VERSION = "0.0.6"
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.unpack("C*").map{ |c| c ^ 0x90 }.pack("C*")
256
+ encrypt_00000000(data)
256
257
  end
257
258
 
258
259
  def self.decrypt_12345600(data)
259
- encrypt_12345600(data)
260
+ encrypt_00000000(data)
260
261
  end
261
262
 
262
- def self.cache
263
- @@cache
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
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlib
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 17
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 6
10
- version: 0.0.6
9
+ - 7
10
+ version: 0.0.7
11
11
  platform: ruby
12
12
  authors:
13
13
  - HD Moore