yEnc 0.0.30 → 0.0.31
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.
- data/lib/y_enc.rb +4 -2
- metadata +39 -21
data/lib/y_enc.rb
CHANGED
@@ -21,13 +21,14 @@ class YEnc
|
|
21
21
|
def encode_to_file outputfilename
|
22
22
|
outputfile = File.new(@outputpath + outputfilename, "w")
|
23
23
|
outputfile.puts "=ybegin size=#{File.size?(@filepath)} line=128 name=#{File.basename @filepath}\n"
|
24
|
+
special = { 0 => nil, 10 => nil, 13 => nil, 61 => nil }
|
24
25
|
File.open(@filepath,'rb') do |f|
|
25
26
|
until f.eof?
|
26
27
|
#Read in 128 bytes at a time
|
27
28
|
buffer = f.read(128)
|
28
29
|
buffer.each_byte do |byte|
|
29
30
|
char_to_write = (byte + 42) % 256
|
30
|
-
if
|
31
|
+
if special.has_key?(char_to_write)
|
31
32
|
outputfile.putc '='
|
32
33
|
char_to_write = (char_to_write + 64) % 256
|
33
34
|
end
|
@@ -44,12 +45,13 @@ class YEnc
|
|
44
45
|
# Author: Tadeus Dobrovolskij
|
45
46
|
def encode
|
46
47
|
sio = StringIO.new("","w:ASCII-8BIT")
|
48
|
+
special = { 0 => nil, 10 => nil, 13 => nil, 61 => nil }
|
47
49
|
File.open(@filepath,'rb') do |b|
|
48
50
|
until b.eof?
|
49
51
|
buffer = b.read(128)
|
50
52
|
buffer.each_byte do |byte|
|
51
53
|
char_to_write = (byte + 42) % 256
|
52
|
-
if
|
54
|
+
if special.has_key?(char_to_write)
|
53
55
|
sio.putc '='
|
54
56
|
char_to_write = (char_to_write + 64) % 256
|
55
57
|
end
|
metadata
CHANGED
@@ -1,45 +1,63 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: yEnc
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 0
|
8
|
+
- 31
|
9
|
+
version: 0.0.31
|
6
10
|
platform: ruby
|
7
|
-
authors:
|
11
|
+
authors:
|
8
12
|
- Sam Contapay
|
13
|
+
- Tadeus Dobrovolskij
|
9
14
|
autorequire:
|
10
15
|
bindir: bin
|
11
16
|
cert_chain: []
|
12
|
-
|
17
|
+
|
18
|
+
date: 2013-11-08 00:00:00 -08:00
|
19
|
+
default_executable:
|
13
20
|
dependencies: []
|
21
|
+
|
14
22
|
description: yEnc decoder written in Ruby
|
15
23
|
email: sam.contapay@gmail.com
|
16
24
|
executables: []
|
25
|
+
|
17
26
|
extensions: []
|
27
|
+
|
18
28
|
extra_rdoc_files: []
|
19
|
-
|
29
|
+
|
30
|
+
files:
|
20
31
|
- lib/y_enc.rb
|
32
|
+
has_rdoc: true
|
21
33
|
homepage: https://github.com/madgeekfiend/yenc
|
22
34
|
licenses: []
|
35
|
+
|
23
36
|
post_install_message:
|
24
37
|
rdoc_options: []
|
25
|
-
|
38
|
+
|
39
|
+
require_paths:
|
26
40
|
- lib
|
27
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
requirements:
|
36
|
-
- -
|
37
|
-
- !ruby/object:Gem::Version
|
38
|
-
|
41
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
segments:
|
46
|
+
- 0
|
47
|
+
version: "0"
|
48
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
segments:
|
53
|
+
- 0
|
54
|
+
version: "0"
|
39
55
|
requirements: []
|
56
|
+
|
40
57
|
rubyforge_project:
|
41
|
-
rubygems_version: 1.
|
58
|
+
rubygems_version: 1.3.6
|
42
59
|
signing_key:
|
43
60
|
specification_version: 3
|
44
61
|
summary: yEnc
|
45
62
|
test_files: []
|
63
|
+
|