fast_xor 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/ext/xor/xor.c +1 -0
- data/spec/xor_spec.rb +27 -2
- metadata +49 -67
data/ext/xor/xor.c
CHANGED
data/spec/xor_spec.rb
CHANGED
@@ -9,14 +9,14 @@ describe String do
|
|
9
9
|
@invx = (0...@len).collect { |i| @x[i].ord ^ 0xFF }.pack('C*')
|
10
10
|
end
|
11
11
|
|
12
|
-
it
|
12
|
+
it "two" do
|
13
13
|
@x.dup.xor!(@x) .should == @zero
|
14
14
|
@x.dup.xor!(@invx).should == @one
|
15
15
|
@x.dup.xor!(@zero).should == @x
|
16
16
|
@x.dup.xor!(@one) .should == @invx
|
17
17
|
end
|
18
18
|
|
19
|
-
it
|
19
|
+
it "three" do
|
20
20
|
@x.dup.xor!(@x, @x) .should == @x
|
21
21
|
@x.dup.xor!(@x, @invx).should == @invx
|
22
22
|
@x.dup.xor!(@x, @zero).should == @zero
|
@@ -37,4 +37,29 @@ describe String do
|
|
37
37
|
@x.dup.xor!(@one, @zero).should == @invx
|
38
38
|
@x.dup.xor!(@one, @one) .should == @x
|
39
39
|
end
|
40
|
+
|
41
|
+
it "shared" do
|
42
|
+
a = 'string'
|
43
|
+
b = a
|
44
|
+
b.xor!(@x)
|
45
|
+
b.should == a
|
46
|
+
end
|
47
|
+
|
48
|
+
it "embedded" do
|
49
|
+
a = 'an embedded string'
|
50
|
+
a.length.should <= 23
|
51
|
+
|
52
|
+
b = a.dup
|
53
|
+
b.xor!(@x)
|
54
|
+
b.should_not == a
|
55
|
+
end
|
56
|
+
|
57
|
+
it "heap" do
|
58
|
+
a = 'a very long string, stored on the heap'
|
59
|
+
a.length.should > 24
|
60
|
+
|
61
|
+
b = a.dup
|
62
|
+
b.xor!(@x*2)
|
63
|
+
b.should_not == a
|
64
|
+
end
|
40
65
|
end
|
metadata
CHANGED
@@ -1,111 +1,93 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: fast_xor
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
- 1
|
7
|
-
- 1
|
8
|
-
- 0
|
9
|
-
version: 1.1.0
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.1.1
|
5
|
+
prerelease:
|
10
6
|
platform: ruby
|
11
|
-
authors:
|
7
|
+
authors:
|
12
8
|
- Steve Sloan
|
13
9
|
autorequire:
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
dependencies:
|
20
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2012-07-22 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
21
15
|
name: rake
|
22
|
-
requirement: &
|
16
|
+
requirement: &17550840 !ruby/object:Gem::Requirement
|
23
17
|
none: false
|
24
|
-
requirements:
|
25
|
-
- -
|
26
|
-
- !ruby/object:Gem::Version
|
27
|
-
|
28
|
-
- 0
|
29
|
-
version: "0"
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
30
22
|
type: :runtime
|
31
23
|
prerelease: false
|
32
|
-
version_requirements: *
|
33
|
-
- !ruby/object:Gem::Dependency
|
24
|
+
version_requirements: *17550840
|
25
|
+
- !ruby/object:Gem::Dependency
|
34
26
|
name: rake-compiler
|
35
|
-
requirement: &
|
27
|
+
requirement: &17550400 !ruby/object:Gem::Requirement
|
36
28
|
none: false
|
37
|
-
requirements:
|
38
|
-
- -
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
|
41
|
-
- 0
|
42
|
-
version: "0"
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
43
33
|
type: :runtime
|
44
34
|
prerelease: false
|
45
|
-
version_requirements: *
|
46
|
-
- !ruby/object:Gem::Dependency
|
35
|
+
version_requirements: *17550400
|
36
|
+
- !ruby/object:Gem::Dependency
|
47
37
|
name: rspec
|
48
|
-
requirement: &
|
38
|
+
requirement: &17549940 !ruby/object:Gem::Requirement
|
49
39
|
none: false
|
50
|
-
requirements:
|
51
|
-
- -
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
|
54
|
-
- 2
|
55
|
-
- 0
|
56
|
-
- 1
|
57
|
-
version: 2.0.1
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
58
44
|
type: :development
|
59
45
|
prerelease: false
|
60
|
-
version_requirements: *
|
46
|
+
version_requirements: *17549940
|
61
47
|
description: Provides a C-optimized method for in-place XORing of two (or three) strings
|
62
48
|
email: steve@finagle.org
|
63
49
|
executables: []
|
64
|
-
|
65
|
-
extensions:
|
50
|
+
extensions:
|
66
51
|
- ext/xor/extconf.rb
|
67
|
-
extra_rdoc_files:
|
52
|
+
extra_rdoc_files:
|
68
53
|
- README.rdoc
|
69
|
-
files:
|
54
|
+
files:
|
70
55
|
- MIT-LICENSE
|
71
56
|
- README.rdoc
|
72
57
|
- benchmark
|
73
58
|
- ext/xor/xor.c
|
74
59
|
- ext/xor/extconf.rb
|
75
60
|
- spec/xor_spec.rb
|
76
|
-
has_rdoc: true
|
77
61
|
homepage: http://github.com/CodeMonkeySteve/fast_xor
|
78
62
|
licenses: []
|
79
|
-
|
80
63
|
post_install_message:
|
81
|
-
rdoc_options:
|
64
|
+
rdoc_options:
|
82
65
|
- --charset=UTF-8
|
83
|
-
require_paths:
|
66
|
+
require_paths:
|
84
67
|
- lib/fast_xor
|
85
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
68
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
86
69
|
none: false
|
87
|
-
requirements:
|
88
|
-
- -
|
89
|
-
- !ruby/object:Gem::Version
|
90
|
-
|
91
|
-
segments:
|
70
|
+
requirements:
|
71
|
+
- - ! '>='
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '0'
|
74
|
+
segments:
|
92
75
|
- 0
|
93
|
-
|
94
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
76
|
+
hash: -1801665792831442865
|
77
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
95
78
|
none: false
|
96
|
-
requirements:
|
97
|
-
- -
|
98
|
-
- !ruby/object:Gem::Version
|
99
|
-
|
100
|
-
segments:
|
79
|
+
requirements:
|
80
|
+
- - ! '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
segments:
|
101
84
|
- 0
|
102
|
-
|
85
|
+
hash: -1801665792831442865
|
103
86
|
requirements: []
|
104
|
-
|
105
87
|
rubyforge_project:
|
106
|
-
rubygems_version: 1.
|
88
|
+
rubygems_version: 1.8.16
|
107
89
|
signing_key:
|
108
90
|
specification_version: 3
|
109
91
|
summary: Fast String XOR operator
|
110
|
-
test_files:
|
92
|
+
test_files:
|
111
93
|
- spec/xor_spec.rb
|