xorcist 1.1.2 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +24 -31
- data/lib/xorcist/refinements.rb +5 -1
- data/lib/xorcist/version.rb +1 -1
- data/lib/xorcist.rb +5 -16
- metadata +20 -43
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -2
- metadata.gz.sig +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 6ee6808ecd35a87100601f25ef22c045cda8fe6f539aaaacc00f98181c49382b
|
4
|
+
data.tar.gz: 17f178c142385f7a22ec43afa01052436bc76f4df57108444f034ffa5d9012d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d36cf607ff0bc2ca680449ab51af0f6efa513dbef36f814d33b54ca9d94e3b7d3df7a8514246397e81874f23a38cdc4e9e2479f5bcd26f64dd3f0cbc69d95496
|
7
|
+
data.tar.gz: 42cc8a921af0cadbbb9bb0a858a8d2ba9f0ebc3d77640c6d37fe70bfaa959336130798f983baba04eaf73a4d53d30f68420651f4632e0f756893c82400bec899
|
data/README.md
CHANGED
@@ -1,10 +1,12 @@
|
|
1
1
|
# Xorcist :ghost:
|
2
2
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/xorcist.svg)](http://badge.fury.io/rb/xorcist)
|
4
|
-
[![
|
4
|
+
[![Test](https://github.com/fny/xorcist/actions/workflows/test.yml/badge.svg)](https://github.com/fny/xorcist/actions/workflows/test.yml)
|
5
5
|
|
6
6
|
Blazing-fast-cross-platform-monkey-patch-free string XOR. Yes, that means JRuby too.
|
7
7
|
|
8
|
+
Supported platforms: MRI (v2+), JRuby (v9.2+), Truffle (v21+), Truffle+GraalVM (v21+).
|
9
|
+
|
8
10
|
## Usage
|
9
11
|
|
10
12
|
```ruby
|
@@ -41,6 +43,8 @@ a.xor(b)
|
|
41
43
|
a.xor!(b)
|
42
44
|
```
|
43
45
|
|
46
|
+
Note: Refinements will not work in [JRuby 9.2.6](https://github.com/jruby/jruby/issues/5288) and below. This isn't an issue for earlier versions of JRuby 9.0-9.1 or JRuby 9.2.7+.
|
47
|
+
|
44
48
|
You can also monkey patch `String` if you're into that:
|
45
49
|
|
46
50
|
```ruby
|
@@ -53,45 +57,34 @@ String.include(Xorcist::StringMethods)
|
|
53
57
|
|
54
58
|
Note the precise encoding `xor`'s output is undefined in the v1.0-1.x releases. In MRI `xor!` will return a string using your default encoding. With JRuby, `xor!` will return an ASCII-8BIT string.
|
55
59
|
|
56
|
-
## Security
|
57
|
-
|
58
|
-
Xorcist is cryptographically signed. To be sure the gem you install hasn’t been tampered with:
|
59
|
-
|
60
|
-
Add my public key as a trusted certificate:
|
61
|
-
|
62
|
-
gem cert --add <(curl -Ls https://raw.github.com/fny/xorcist/master/certs/fny.pem)
|
63
|
-
|
64
|
-
Then install the gem:
|
65
|
-
|
66
|
-
gem install xorcist -P HighSecurity
|
67
|
-
|
68
|
-
Checksums for all versions are also included in the checksums directory.
|
69
|
-
|
70
60
|
## Benchmarks
|
71
61
|
|
72
|
-
|
62
|
+
Run from my Macbook. Run 'em yourself with `bin/benchmark`. You'll need to have [`benchmark-ips`](https://github.com/evanphx/benchmark-ips) installed.
|
73
63
|
|
74
|
-
### MRI
|
64
|
+
### MRI
|
75
65
|
|
76
66
|
```
|
67
|
+
ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [arm64-darwin21]
|
68
|
+
|
69
|
+
Warming up --------------------------------------
|
70
|
+
ruby 91.478k i/100ms
|
71
|
+
xorcist 1.043M i/100ms
|
77
72
|
Calculating -------------------------------------
|
78
|
-
ruby
|
79
|
-
xorcist
|
80
|
-
-------------------------------------------------
|
81
|
-
ruby 376.513k (± 0.5%) i/s - 1.899M
|
82
|
-
xorcist 2.150M (± 3.9%) i/s - 10.774M
|
73
|
+
ruby 928.443k (± 2.0%) i/s - 4.665M in 5.026920s
|
74
|
+
xorcist 10.438M (± 1.4%) i/s - 53.187M in 5.096610s
|
83
75
|
```
|
84
76
|
|
85
|
-
### JRuby
|
77
|
+
### JRuby
|
86
78
|
|
87
79
|
```
|
88
|
-
|
80
|
+
jruby 9.3.6.0 (2.6.8) 2022-06-27 7a2cbcd376 OpenJDK 64-Bit Server VM 18.0.2+0 on 18.0.2+0 +jit [arm64-darwin]
|
81
|
+
|
82
|
+
Warming up --------------------------------------
|
83
|
+
ruby 236.487k i/100ms
|
84
|
+
xorcist 813.234k i/100ms
|
89
85
|
Calculating -------------------------------------
|
90
|
-
ruby
|
91
|
-
xorcist
|
92
|
-
-------------------------------------------------
|
93
|
-
ruby 978.078k (±11.2%) i/s - 4.801M
|
94
|
-
xorcist 3.897M (±14.1%) i/s - 19.012M
|
86
|
+
ruby 2.673M (±11.0%) i/s - 13.243M in 5.025536s
|
87
|
+
xorcist 20.432M (±24.4%) i/s - 90.269M in 5.000974s
|
95
88
|
```
|
96
89
|
|
97
90
|
## Installation
|
@@ -112,7 +105,7 @@ Or install it yourself as:
|
|
112
105
|
|
113
106
|
## Contributing
|
114
107
|
|
115
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/fny/xorcist.
|
108
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/fny/xorcist.
|
116
109
|
|
117
110
|
## License
|
118
111
|
|
@@ -123,5 +116,5 @@ The gem is available as open source under the terms of the [MIT License](http://
|
|
123
116
|
- [Steve Sloan](http://www.finagle.org) for his [fast_xor gem](https://github.com/CodeMonkeySteve/fast_xor) from which most of the tests are borrowed
|
124
117
|
- [James Coglan](http://jcoglan.com) for his [guide on writing a JRuby Java extension](https://blog.jcoglan.com/2012/08/02/your-first-ruby-native-extension-java/)
|
125
118
|
- [Thomas Leitner](https://github.com/gettalong) for a faster pure Ruby XOR implementation that's used in the benchmark
|
119
|
+
- [The JRuby Team](https://twitter.com/jruby) for their assistance in debugging various issues over the years
|
126
120
|
- To all [contributers](https://github.com/fny/xorcist/graphs/contributors)! :beers:
|
127
|
-
|
data/lib/xorcist/refinements.rb
CHANGED
@@ -3,7 +3,11 @@ require 'xorcist/string_methods'
|
|
3
3
|
module Xorcist
|
4
4
|
module Refinements
|
5
5
|
refine String do
|
6
|
-
|
6
|
+
if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.1.0")
|
7
|
+
import_methods Xorcist::StringMethods
|
8
|
+
else
|
9
|
+
include Xorcist::StringMethods
|
10
|
+
end
|
7
11
|
end
|
8
12
|
end
|
9
13
|
end
|
data/lib/xorcist/version.rb
CHANGED
data/lib/xorcist.rb
CHANGED
@@ -1,8 +1,11 @@
|
|
1
1
|
require 'xorcist/version'
|
2
2
|
|
3
3
|
if RUBY_ENGINE == 'jruby'
|
4
|
-
require '
|
5
|
-
require
|
4
|
+
require 'jruby'
|
5
|
+
require 'xorcist.jar'
|
6
|
+
if JRuby.respond_to?(:load_ext)
|
7
|
+
JRuby::Util.load_ext('fny.xorcist.XorcistLibrary')
|
8
|
+
end
|
6
9
|
else
|
7
10
|
require 'xorcist/xorcist'
|
8
11
|
end
|
@@ -12,18 +15,4 @@ module Xorcist
|
|
12
15
|
def xor(x, y)
|
13
16
|
xor!(x.dup, y)
|
14
17
|
end
|
15
|
-
|
16
|
-
# rb_str_modify isn't blowing up for frozen strings under Rubinius, so we'll
|
17
|
-
# hack in a fix here
|
18
|
-
if RUBY_ENGINE == 'rbx'
|
19
|
-
alias_method :_xor!, :xor!
|
20
|
-
remove_method :xor!
|
21
|
-
def xor!(x, y)
|
22
|
-
if x.frozen?
|
23
|
-
raise(RuntimeError, "can't modify frozen String")
|
24
|
-
else
|
25
|
-
_xor!(x, y)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
18
|
end
|
metadata
CHANGED
@@ -1,51 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xorcist
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Faraz Yashar
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
|
-
cert_chain:
|
11
|
-
-
|
12
|
-
-----BEGIN CERTIFICATE-----
|
13
|
-
MIIDgDCCAmigAwIBAgIBATANBgkqhkiG9w0BAQUFADBDMRUwEwYDVQQDDAxmYXJh
|
14
|
-
ei55YXNoYXIxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixkARkW
|
15
|
-
A2NvbTAeFw0xODAyMjcwMzE2MTFaFw0xOTAyMjcwMzE2MTFaMEMxFTATBgNVBAMM
|
16
|
-
DGZhcmF6Lnlhc2hhcjEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYKCZImiZPy
|
17
|
-
LGQBGRYDY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAv9y0yeyB
|
18
|
-
vsiW6FTsJk7g0jt0A/emMqN4MUHXJQDGmUnlFSHNqfXUJiXuZanE8ZCnS6++0ouS
|
19
|
-
HUrzrbc3Gbw7rNj9/aQpm7SS3Lo70djbQlGwZq1tUteXTWzp90lwI4IiWaWTCRQP
|
20
|
-
AgwawkvHYnDLC/iw/F/CZLiaJG4ZLhYBd1DxCEgz3qrwD3G1d35+tj4vbqEqtx/e
|
21
|
-
UHtNbj86e3WTPYAJ6MWAk+qLDVX9JiDaIAzW42yRed6FrJexZunsuW9atTdeAUTr
|
22
|
-
SJJYYL1agJRgX3SefW/o/tKsBrl/tG7lHIAH4TopXHX4aXoSotWSqI+v4pRnoV3v
|
23
|
-
u2kusE3YZDN+jwIDAQABo38wfTAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNV
|
24
|
-
HQ4EFgQUJzDdPthnahTQPLPK2vZmKE9VcN0wIQYDVR0RBBowGIEWZmFyYXoueWFz
|
25
|
-
aGFyQGdtYWlsLmNvbTAhBgNVHRIEGjAYgRZmYXJhei55YXNoYXJAZ21haWwuY29t
|
26
|
-
MA0GCSqGSIb3DQEBBQUAA4IBAQA8vHFCyzGOZkLX48NdnbSp9/1PNmt65ABxjiXV
|
27
|
-
dLmlBVfag1//6tU1hdxvfwrFj/6p0J1Z17MY0/zQerTK9hGT4PWOc05ASmCADDFX
|
28
|
-
igA/4xc3Z6L+3IM5gmcUjkZEwCq4QxCW5+LlWAO3XYoInufiA7xpjaDGtarZLIJw
|
29
|
-
8tWNtyKkYHdUkWOf7mARiqKZmzc+z9MbBS6+RnyjpVjSc3VSNVl2RNOyQuV4bHcU
|
30
|
-
EWAzos45LBmn8UZPzUb/szfC1PTzuQp4R7lUCOqi7ExaZF0oYg7JqkRtHDhV/K/c
|
31
|
-
E0Og3eJcioAAuEM3ujecxGYxFkG7zDNswn47lCy6xVzBk4iF
|
32
|
-
-----END CERTIFICATE-----
|
33
|
-
date: 2018-08-03 00:00:00.000000000 Z
|
10
|
+
cert_chain: []
|
11
|
+
date: 2022-08-02 00:00:00.000000000 Z
|
34
12
|
dependencies:
|
35
13
|
- !ruby/object:Gem::Dependency
|
36
14
|
name: bundler
|
37
15
|
requirement: !ruby/object:Gem::Requirement
|
38
16
|
requirements:
|
39
|
-
- - "
|
17
|
+
- - ">="
|
40
18
|
- !ruby/object:Gem::Version
|
41
|
-
version: '
|
19
|
+
version: '0'
|
42
20
|
type: :development
|
43
21
|
prerelease: false
|
44
22
|
version_requirements: !ruby/object:Gem::Requirement
|
45
23
|
requirements:
|
46
|
-
- - "
|
24
|
+
- - ">="
|
47
25
|
- !ruby/object:Gem::Version
|
48
|
-
version: '
|
26
|
+
version: '0'
|
49
27
|
- !ruby/object:Gem::Dependency
|
50
28
|
name: minitest
|
51
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -64,30 +42,30 @@ dependencies:
|
|
64
42
|
name: rake
|
65
43
|
requirement: !ruby/object:Gem::Requirement
|
66
44
|
requirements:
|
67
|
-
- - "
|
45
|
+
- - ">="
|
68
46
|
- !ruby/object:Gem::Version
|
69
|
-
version: '
|
47
|
+
version: '0'
|
70
48
|
type: :development
|
71
49
|
prerelease: false
|
72
50
|
version_requirements: !ruby/object:Gem::Requirement
|
73
51
|
requirements:
|
74
|
-
- - "
|
52
|
+
- - ">="
|
75
53
|
- !ruby/object:Gem::Version
|
76
|
-
version: '
|
54
|
+
version: '0'
|
77
55
|
- !ruby/object:Gem::Dependency
|
78
56
|
name: rake-compiler
|
79
57
|
requirement: !ruby/object:Gem::Requirement
|
80
58
|
requirements:
|
81
|
-
- - "
|
59
|
+
- - ">="
|
82
60
|
- !ruby/object:Gem::Version
|
83
|
-
version:
|
61
|
+
version: 1.1.9
|
84
62
|
type: :development
|
85
63
|
prerelease: false
|
86
64
|
version_requirements: !ruby/object:Gem::Requirement
|
87
65
|
requirements:
|
88
|
-
- - "
|
66
|
+
- - ">="
|
89
67
|
- !ruby/object:Gem::Version
|
90
|
-
version:
|
68
|
+
version: 1.1.9
|
91
69
|
description: Blazing-fast-cross-platform-monkey-patch-free string XOR. Yes, that means
|
92
70
|
JRuby too.
|
93
71
|
email:
|
@@ -108,7 +86,7 @@ homepage: https://github.com/fny/xorcist
|
|
108
86
|
licenses:
|
109
87
|
- MIT
|
110
88
|
metadata: {}
|
111
|
-
post_install_message:
|
89
|
+
post_install_message:
|
112
90
|
rdoc_options: []
|
113
91
|
require_paths:
|
114
92
|
- lib
|
@@ -116,16 +94,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
116
94
|
requirements:
|
117
95
|
- - ">="
|
118
96
|
- !ruby/object:Gem::Version
|
119
|
-
version:
|
97
|
+
version: 2.0.0
|
120
98
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
121
99
|
requirements:
|
122
100
|
- - ">="
|
123
101
|
- !ruby/object:Gem::Version
|
124
102
|
version: '0'
|
125
103
|
requirements: []
|
126
|
-
|
127
|
-
|
128
|
-
signing_key:
|
104
|
+
rubygems_version: 3.3.7
|
105
|
+
signing_key:
|
129
106
|
specification_version: 4
|
130
107
|
summary: Blazing-fast-cross-platform-monkey-patch-free string XOR
|
131
108
|
test_files: []
|
checksums.yaml.gz.sig
DELETED
Binary file
|
data.tar.gz.sig
DELETED
metadata.gz.sig
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
t.��WZ{��o�S�˫)
|