ciphr 0.0.2 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +4 -4
- data/Gemfile.lock +6 -3
- data/LICENSE.txt +22 -22
- data/README.md +13 -4
- data/Rakefile +7 -7
- data/TODO +320 -320
- data/bin/ciphr +3 -1
- data/ciphr.gemspec +0 -0
- data/lib/ciphr.rb +2 -0
- data/lib/ciphr/function_registry.rb +0 -0
- data/lib/ciphr/functions.rb +63 -62
- data/lib/ciphr/functions/ascii.rb +25 -0
- data/lib/ciphr/functions/base_radix.rb +205 -205
- data/lib/ciphr/functions/bitwise.rb +80 -80
- data/lib/ciphr/functions/crypto.rb +42 -44
- data/lib/ciphr/functions/openssl.rb +104 -104
- data/lib/ciphr/functions/reader.rb +46 -44
- data/lib/ciphr/functions/simple.rb +121 -121
- data/lib/ciphr/functions/url.rb +38 -38
- data/lib/ciphr/functions/zlib.rb +95 -94
- data/lib/ciphr/parser.rb +0 -0
- data/lib/ciphr/stream.rb +49 -49
- data/lib/ciphr/version.rb +1 -1
- data/pkg/ciphr-0.0.3.gem +0 -0
- data/spec/ciphr_spec.rb +21 -21
- data/spec/functions_spec.rb +31 -31
- data/spec/randomizer_spec.rb +55 -55
- data/spec/spec_helper.rb +4 -4
- data/spec/stream_spec.rb +38 -38
- data/tests/output.r26.2.0.0.bin +0 -0
- data/tests/output.r26.2.1.1.bin +0 -0
- data/tests/output.r30.2.0.0.bin +0 -0
- data/tests/output.r30.2.1.1.bin +0 -0
- data/tests/output.r34.2.0.0.bin +0 -0
- data/tests/output.r34.2.1.1.bin +0 -0
- data/tests/testcase.r26.bin +0 -0
- data/tests/testcase.r30.bin +0 -0
- data/tests/testcase.r34.bin +0 -0
- metadata +5 -6
- data/pkg/ciphr-0.0.1.gem +0 -0
- data/pkg/ciphr-0.0.2.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3739e940ec95b6f2491aeeaa2df9eeaeb10d72b9
|
4
|
+
data.tar.gz: b0f74a2f82bea484f3c6c046dd998b9480f512fb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cdde2c8bacdeee0102e77212697146da9d6a2d6e1716126524bf0318d3b19a2ec96fea0da5b1c3a5b1f8fac1a77b670d0a509556fa065d559546efddf66ddb8c
|
7
|
+
data.tar.gz: 87b67823568ba5d67f999c72d753d96ae9dbbabd43b2412e2265f710dee5fb2043eab82c5091cf8dfbee58a1723979a0cb3ec3a97c1929e5a50e2405b859af17
|
data/Gemfile
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
source 'https://rubygems.org'
|
2
|
-
|
3
|
-
# Specify your gem's dependencies in ciphr.gemspec
|
4
|
-
gemspec
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
# Specify your gem's dependencies in ciphr.gemspec
|
4
|
+
gemspec
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
ciphr (0.0.
|
4
|
+
ciphr (0.0.4)
|
5
5
|
base32 (~> 0.3.2)
|
6
6
|
parslet (~> 1.5.0)
|
7
7
|
slop (~> 3.6.0)
|
@@ -11,7 +11,7 @@ GEM
|
|
11
11
|
specs:
|
12
12
|
base32 (0.3.2)
|
13
13
|
blankslate (2.1.2.4)
|
14
|
-
diff-lcs (1.
|
14
|
+
diff-lcs (1.3)
|
15
15
|
parslet (1.5.0)
|
16
16
|
blankslate (~> 2.0)
|
17
17
|
rake (10.5.0)
|
@@ -19,7 +19,7 @@ GEM
|
|
19
19
|
rspec-core (~> 3.4.0)
|
20
20
|
rspec-expectations (~> 3.4.0)
|
21
21
|
rspec-mocks (~> 3.4.0)
|
22
|
-
rspec-core (3.4.
|
22
|
+
rspec-core (3.4.4)
|
23
23
|
rspec-support (~> 3.4.0)
|
24
24
|
rspec-expectations (3.4.0)
|
25
25
|
diff-lcs (>= 1.2.0, < 2.0)
|
@@ -38,3 +38,6 @@ DEPENDENCIES
|
|
38
38
|
ciphr!
|
39
39
|
rake (~> 10.5.0)
|
40
40
|
rspec (~> 3.4.0)
|
41
|
+
|
42
|
+
BUNDLED WITH
|
43
|
+
1.15.4
|
data/LICENSE.txt
CHANGED
@@ -1,22 +1,22 @@
|
|
1
|
-
Copyright (c) 2013 Chris Frohoff
|
2
|
-
|
3
|
-
MIT License
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
-
a copy of this software and associated documentation files (the
|
7
|
-
"Software"), to deal in the Software without restriction, including
|
8
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
-
permit persons to whom the Software is furnished to do so, subject to
|
11
|
-
the following conditions:
|
12
|
-
|
13
|
-
The above copyright notice and this permission notice shall be
|
14
|
-
included in all copies or substantial portions of the Software.
|
15
|
-
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
1
|
+
Copyright (c) 2013 Chris Frohoff
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -73,8 +73,19 @@ $ ciphr @/etc/hosts aes-128-cbc[0xdeadbeefdeadbeefdeadbeefdeadbeef] ~aes-128-cbc
|
|
73
73
|
|
74
74
|
## Installation
|
75
75
|
|
76
|
-
|
77
|
-
|
76
|
+
#### Rubygems
|
77
|
+
|
78
|
+
```shell
|
79
|
+
$ gem install ciphr
|
80
|
+
Fetching: ciphr-0.0.1.gem (100%)
|
81
|
+
Successfully installed ciphr-0.0.1
|
82
|
+
Parsing documentation for ciphr-0.0.1
|
83
|
+
Installing ri documentation for ciphr-0.0.1
|
84
|
+
Done installing documentation for ciphr after 2 seconds
|
85
|
+
1 gem installed
|
86
|
+
```
|
87
|
+
|
88
|
+
#### Source
|
78
89
|
|
79
90
|
Requires bundler to be installed (`gem install bundler`)
|
80
91
|
|
@@ -291,8 +302,6 @@ Available Functions: aliases ([args])
|
|
291
302
|
tr, translate (input, ch1, ch2)
|
292
303
|
repl, replace (input, search, replace)
|
293
304
|
rc4-ruby (input, key)
|
294
|
-
|
295
|
-
|
296
305
|
```
|
297
306
|
|
298
307
|
## Developing
|
data/Rakefile
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
require 'bundler/gem_tasks'
|
2
|
-
require 'rspec/core/rake_task'
|
3
|
-
|
4
|
-
RSpec::Core::RakeTask.new(:spec)
|
5
|
-
|
6
|
-
task :default => :spec
|
7
|
-
|
1
|
+
require 'bundler/gem_tasks'
|
2
|
+
require 'rspec/core/rake_task'
|
3
|
+
|
4
|
+
RSpec::Core::RakeTask.new(:spec)
|
5
|
+
|
6
|
+
task :default => :spec
|
7
|
+
|
data/TODO
CHANGED
@@ -1,320 +1,320 @@
|
|
1
|
-
TODO:
|
2
|
-
==========================
|
3
|
-
|
4
|
-
Document use of bash anon named pipes with @ syntax
|
5
|
-
spaces in various places in grammar (between @ and filename, spaces inside of [] and () for calls)
|
6
|
-
|
7
|
-
xor hangs with large keyfiles
|
8
|
-
Context objects, Classes method_missing delegate to singleton instance
|
9
|
-
TTY handling: default trailing newline, colors/escapes for non-printable
|
10
|
-
tr, replace functions
|
11
|
-
interleave/concat multiple streams
|
12
|
-
vararg functions
|
13
|
-
switch endianness
|
14
|
-
|
15
|
-
fix
|
16
|
-
-----------
|
17
|
-
bug in b64 decoding of HFF= => HFE=
|
18
|
-
|
19
|
-
robustness
|
20
|
-
-----------
|
21
|
-
* graceful handling of mismatched data size (key size, base64 chunks, xor)
|
22
|
-
* errors for bad function name or args
|
23
|
-
* case insensitivity for ~b16
|
24
|
-
* high level classification of functions (util, bitwise, hash, cipher, mac, etc)
|
25
|
-
* handling of optional arguments (IVs/nonces, # rounds, etc) without breaking pipe argument prepending
|
26
|
-
* escape/encode non-printable chars if outputting to tty http://blog.bogojoker.com/2009/04/check-if-your-ruby-script-is-in-a-pipe/
|
27
|
-
* description for functions in help
|
28
|
-
|
29
|
-
completeness
|
30
|
-
-----------
|
31
|
-
base64 variants
|
32
|
-
* %/url, b32, ascii85, escape-sequence (\x, String.dump), xml/html
|
33
|
-
* bitwise ops: variants for mismatched lengths?
|
34
|
-
|
35
|
-
|
36
|
-
features
|
37
|
-
---------------
|
38
|
-
functions
|
39
|
-
bitwise ops
|
40
|
-
shift right/left (circular rotate vs fill)
|
41
|
-
not/and/or (similar to xor)
|
42
|
-
hashes
|
43
|
-
crc/adler
|
44
|
-
crypt/scrypt/bcrypt/pbkdf
|
45
|
-
ciphers
|
46
|
-
substitution: caeser/rot/dvorak/vigenère/affine/atbash/avgad/albam
|
47
|
-
physical: rotor/enigma
|
48
|
-
byte ops
|
49
|
-
prepend/append
|
50
|
-
indexed head/tail/substring
|
51
|
-
reverse bits/nibbles/bytes
|
52
|
-
repeat bytes
|
53
|
-
compression
|
54
|
-
gzip/deflate/lz*/bzip2/snappy/rle
|
55
|
-
http://en.wikipedia.org/wiki/Lempel%E2%80%93Ziv
|
56
|
-
generators
|
57
|
-
random bytes
|
58
|
-
|
59
|
-
revamp streams
|
60
|
-
http://readruby.io/io
|
61
|
-
https://github.com/javanthropus/io-like
|
62
|
-
https://github.com/javanthropus/stream
|
63
|
-
https://github.com/rubygems/rubygems/blob/master/lib/rubygems/package/digest_io.rb
|
64
|
-
https://github.com/krypt/binyo
|
65
|
-
https://gist.github.com/tlrobinson/967710
|
66
|
-
https://www.ruby-forum.com/topic/58563
|
67
|
-
https://github.com/jdleesmiller/event_state
|
68
|
-
https://github.com/slagyr/statemachine/
|
69
|
-
namespacing in case of simple name collisions
|
70
|
-
string literals
|
71
|
-
alternative quotes (a la ruby/perl/python, %q[] %Q{} qq() """ ''') http://en.wikibooks.org/wiki/Ruby_Programming/Alternate_quotes
|
72
|
-
allow \xXX escaping
|
73
|
-
extension mechanism (via other gems or simple files)
|
74
|
-
varargs for functions
|
75
|
-
non pipe statements variable writing/reading
|
76
|
-
|
77
|
-
|
78
|
-
random ideas
|
79
|
-
-------------
|
80
|
-
`strings` extraction
|
81
|
-
regex search/replace support
|
82
|
-
fn for executing shell/ruby
|
83
|
-
multi-round hash support
|
84
|
-
|
85
|
-
|
86
|
-
cleanliness
|
87
|
-
-----------
|
88
|
-
refactor variable buffering (probably will improve perf)
|
89
|
-
break up functions
|
90
|
-
|
91
|
-
goals and philosophy
|
92
|
-
==========================
|
93
|
-
functions on streams of bytes
|
94
|
-
kiss: crypto, hashes, bitwise ops, encodings, compression, simple transforms
|
95
|
-
most complex use case: generate rails cookie from marshalled data and secret
|
96
|
-
strive for streaming impls and low memory usage even for large input documents
|
97
|
-
pull/read (vs push/write) based API
|
98
|
-
shell friendly syntax
|
99
|
-
maximum portability, no native gem deps
|
100
|
-
extensible via external gems adding functions
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
scratch notes
|
105
|
-
==========================
|
106
|
-
|
107
|
-
|
108
|
-
reverse(input,chunksize=1,boundarysize=nil)
|
109
|
-
cat(input1,input2,...,inputn)
|
110
|
-
|
111
|
-
ruby -e 'puts ["c","s"].product(["i","y"]).product(["ph","f"]).product(["r","er","yr","ir"]).map{|a| a.flatten.join}'
|
112
|
-
ciphr
|
113
|
-
cipher
|
114
|
-
ciphyr
|
115
|
-
ciphir
|
116
|
-
cifr
|
117
|
-
cifer
|
118
|
-
cifyr
|
119
|
-
cifir
|
120
|
-
cyphr
|
121
|
-
cypher
|
122
|
-
cyphyr
|
123
|
-
cyphir
|
124
|
-
cyfr
|
125
|
-
cyfer
|
126
|
-
cyfyr
|
127
|
-
cyfir
|
128
|
-
siphr
|
129
|
-
sipher
|
130
|
-
siphyr
|
131
|
-
siphir
|
132
|
-
sifr
|
133
|
-
sifer
|
134
|
-
sifyr
|
135
|
-
sifir
|
136
|
-
syphr
|
137
|
-
sypher
|
138
|
-
syphyr
|
139
|
-
syphir
|
140
|
-
syfr
|
141
|
-
syfer
|
142
|
-
syfyr
|
143
|
-
syfir
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
Gem::Specification.find_all.to_a.select{|s| s.dependencies.any?{|d| d.name=='slop'}}.map{|s| s.name}
|
149
|
-
https://codeclimate.com/github/cloudfoundry/vmc/VMC::Plugin/source_listing.js?line_end=53&line_start=11&path=lib%2Fvmc%2Fplugin.rb
|
150
|
-
https://github.com/mmozuras/pronto
|
151
|
-
http://stackoverflow.com/questions/11827950/create-an-extensible-ruby-gem
|
152
|
-
https://bitbucket.org/ged/strelka/src/dc4b6998813161ab4c94656ce144aa36a85ab65e/lib/strelka/discovery.rb
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
http://weblog.rubyonrails.org/2009/9/1/gem-packaging-best-practices/
|
158
|
-
https://gist.github.com/rtomayko/54177
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
11111111 | 11111111 | 11111111
|
164
|
-
111 | 111 | 111 | 111 | 111 | 111 | 111 | 111
|
165
|
-
|
166
|
-
1 2 3 4 5 6 7 8*1 2 3 4 5 6 7 8*1 2 3 4 5 6 7 8
|
167
|
-
1 2 3*1 2 3*1 2 3*1 2 3*1 2 3*1 2 3*1 2 3*1 2 3
|
168
|
-
|
169
|
-
|
170
|
-
~b64,hmac(abcd,~b64),b16,xor(deef,~b64)
|
171
|
-
~des
|
172
|
-
|
173
|
-
=abcd/^hex/b64/hmac[=abcd/^b64]=/
|
174
|
-
|
175
|
-
{abcd},~hex,b64/hmac-sha1[[{abcd},b64]]
|
176
|
-
|
177
|
-
=abcd ~hex hmac[=foo] ?key
|
178
|
-
|
179
|
-
~[],?@^#{}
|
180
|
-
|
181
|
-
|
182
|
-
0x01
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
foo#bar^baz[]
|
187
|
-
foo;bar|baz()
|
188
|
-
|
189
|
-
(foo|bar)|baz
|
190
|
-
|
191
|
-
((foo)|bar)|baz
|
192
|
-
|
193
|
-
assign var: ?varname
|
194
|
-
ref var: #varname
|
195
|
-
literal: =value
|
196
|
-
separator: " "
|
197
|
-
file reference: @filepath
|
198
|
-
|
199
|
-
% in url
|
200
|
-
used in b64: _-:!/.+=
|
201
|
-
shell ok: ~,.-_{}[]/?%#@^+=:
|
202
|
-
shell not ok: ()|!$&*\;'"<>`
|
203
|
-
|
204
|
-
sh b64
|
205
|
-
` x
|
206
|
-
~ x x
|
207
|
-
!
|
208
|
-
@ x x
|
209
|
-
# x x
|
210
|
-
$ x
|
211
|
-
% x x
|
212
|
-
^ x x
|
213
|
-
& x
|
214
|
-
* x
|
215
|
-
() x
|
216
|
-
- x
|
217
|
-
_ x
|
218
|
-
= x b
|
219
|
-
+ x
|
220
|
-
[] x x
|
221
|
-
{} x x
|
222
|
-
; x
|
223
|
-
: x
|
224
|
-
' x
|
225
|
-
" x
|
226
|
-
, x x
|
227
|
-
. x
|
228
|
-
/ x
|
229
|
-
<> x
|
230
|
-
? x x
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
x(a)|y(b)|z(c)
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
z
|
239
|
-
|
240
|
-
y c
|
241
|
-
|
242
|
-
x b
|
243
|
-
|
244
|
-
a
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
file
|
252
|
-
|
|
253
|
-
V
|
254
|
-
~hex
|
255
|
-
|
|
256
|
-
V
|
257
|
-
stdin --> aes --> hex --> stdout
|
258
|
-
|
259
|
-
|
260
|
-
file1 file2
|
261
|
-
| |
|
262
|
-
V V
|
263
|
-
~hex ~hex
|
264
|
-
| |
|
265
|
-
V V
|
266
|
-
stdin --> aes --> aes -> hex --> stdout
|
267
|
-
|
268
|
-
|
269
|
-
stdin --> md5 --> hex --> stdout
|
270
|
-
|
271
|
-
|
272
|
-
stdin --> md5 --> md5 --> ... -> md5 --> hex --> stdout
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
base64: read multiple loop
|
278
|
-
input.read(4) {|bytes,eof|
|
279
|
-
output.write(encode(bytes))
|
280
|
-
}
|
281
|
-
|
282
|
-
cipher: read full init, read arbitrary loop, special end
|
283
|
-
key.read() {|bytes,eof|
|
284
|
-
@bytes = bytes
|
285
|
-
}
|
286
|
-
input.read(256) {|bytes,eof|
|
287
|
-
output.write(cipher.update)
|
288
|
-
}
|
289
|
-
|
290
|
-
xor-repeat: read full init, read arbitrary loop
|
291
|
-
key.read() {|bytes,eof|}
|
292
|
-
|
293
|
-
|
294
|
-
xor-trunc: read arbitrary loop
|
295
|
-
key.read(1) && input.read(1) {
|
296
|
-
|
297
|
-
}
|
298
|
-
|
299
|
-
|
300
|
-
md5: read arbitrary loop, special end
|
301
|
-
|
302
|
-
hmac: read full init, read arbitrary loop, special end
|
303
|
-
|
304
|
-
def pump
|
305
|
-
if input.size >= 1 && key.size >= 1
|
306
|
-
output.write(input.read(1) ^ key.read(1))
|
307
|
-
end
|
308
|
-
end
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
IDEAS:
|
313
|
-
|
314
|
-
method_missing for arguments in function body
|
315
|
-
|
316
|
-
|
317
|
-
+ for concat
|
318
|
-
* for repeat
|
319
|
-
^ for recurse
|
320
|
-
|
1
|
+
TODO:
|
2
|
+
==========================
|
3
|
+
|
4
|
+
Document use of bash anon named pipes with @ syntax
|
5
|
+
spaces in various places in grammar (between @ and filename, spaces inside of [] and () for calls)
|
6
|
+
|
7
|
+
xor hangs with large keyfiles
|
8
|
+
Context objects, Classes method_missing delegate to singleton instance
|
9
|
+
TTY handling: default trailing newline, colors/escapes for non-printable
|
10
|
+
tr, replace functions
|
11
|
+
interleave/concat multiple streams
|
12
|
+
vararg functions
|
13
|
+
switch endianness
|
14
|
+
|
15
|
+
fix
|
16
|
+
-----------
|
17
|
+
bug in b64 decoding of HFF= => HFE=
|
18
|
+
|
19
|
+
robustness
|
20
|
+
-----------
|
21
|
+
* graceful handling of mismatched data size (key size, base64 chunks, xor)
|
22
|
+
* errors for bad function name or args
|
23
|
+
* case insensitivity for ~b16
|
24
|
+
* high level classification of functions (util, bitwise, hash, cipher, mac, etc)
|
25
|
+
* handling of optional arguments (IVs/nonces, # rounds, etc) without breaking pipe argument prepending
|
26
|
+
* escape/encode non-printable chars if outputting to tty http://blog.bogojoker.com/2009/04/check-if-your-ruby-script-is-in-a-pipe/
|
27
|
+
* description for functions in help
|
28
|
+
|
29
|
+
completeness
|
30
|
+
-----------
|
31
|
+
base64 variants
|
32
|
+
* %/url, b32, ascii85, escape-sequence (\x, String.dump), xml/html
|
33
|
+
* bitwise ops: variants for mismatched lengths?
|
34
|
+
|
35
|
+
|
36
|
+
features
|
37
|
+
---------------
|
38
|
+
functions
|
39
|
+
bitwise ops
|
40
|
+
shift right/left (circular rotate vs fill)
|
41
|
+
not/and/or (similar to xor)
|
42
|
+
hashes
|
43
|
+
crc/adler
|
44
|
+
crypt/scrypt/bcrypt/pbkdf
|
45
|
+
ciphers
|
46
|
+
substitution: caeser/rot/dvorak/vigenère/affine/atbash/avgad/albam
|
47
|
+
physical: rotor/enigma
|
48
|
+
byte ops
|
49
|
+
prepend/append
|
50
|
+
indexed head/tail/substring
|
51
|
+
reverse bits/nibbles/bytes
|
52
|
+
repeat bytes
|
53
|
+
compression
|
54
|
+
gzip/deflate/lz*/bzip2/snappy/rle
|
55
|
+
http://en.wikipedia.org/wiki/Lempel%E2%80%93Ziv
|
56
|
+
generators
|
57
|
+
random bytes
|
58
|
+
|
59
|
+
revamp streams
|
60
|
+
http://readruby.io/io
|
61
|
+
https://github.com/javanthropus/io-like
|
62
|
+
https://github.com/javanthropus/stream
|
63
|
+
https://github.com/rubygems/rubygems/blob/master/lib/rubygems/package/digest_io.rb
|
64
|
+
https://github.com/krypt/binyo
|
65
|
+
https://gist.github.com/tlrobinson/967710
|
66
|
+
https://www.ruby-forum.com/topic/58563
|
67
|
+
https://github.com/jdleesmiller/event_state
|
68
|
+
https://github.com/slagyr/statemachine/
|
69
|
+
namespacing in case of simple name collisions
|
70
|
+
string literals
|
71
|
+
alternative quotes (a la ruby/perl/python, %q[] %Q{} qq() """ ''') http://en.wikibooks.org/wiki/Ruby_Programming/Alternate_quotes
|
72
|
+
allow \xXX escaping
|
73
|
+
extension mechanism (via other gems or simple files)
|
74
|
+
varargs for functions
|
75
|
+
non pipe statements variable writing/reading
|
76
|
+
|
77
|
+
|
78
|
+
random ideas
|
79
|
+
-------------
|
80
|
+
`strings` extraction
|
81
|
+
regex search/replace support
|
82
|
+
fn for executing shell/ruby
|
83
|
+
multi-round hash support
|
84
|
+
|
85
|
+
|
86
|
+
cleanliness
|
87
|
+
-----------
|
88
|
+
refactor variable buffering (probably will improve perf)
|
89
|
+
break up functions
|
90
|
+
|
91
|
+
goals and philosophy
|
92
|
+
==========================
|
93
|
+
functions on streams of bytes
|
94
|
+
kiss: crypto, hashes, bitwise ops, encodings, compression, simple transforms
|
95
|
+
most complex use case: generate rails cookie from marshalled data and secret
|
96
|
+
strive for streaming impls and low memory usage even for large input documents
|
97
|
+
pull/read (vs push/write) based API
|
98
|
+
shell friendly syntax
|
99
|
+
maximum portability, no native gem deps
|
100
|
+
extensible via external gems adding functions
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
scratch notes
|
105
|
+
==========================
|
106
|
+
|
107
|
+
|
108
|
+
reverse(input,chunksize=1,boundarysize=nil)
|
109
|
+
cat(input1,input2,...,inputn)
|
110
|
+
|
111
|
+
ruby -e 'puts ["c","s"].product(["i","y"]).product(["ph","f"]).product(["r","er","yr","ir"]).map{|a| a.flatten.join}'
|
112
|
+
ciphr
|
113
|
+
cipher
|
114
|
+
ciphyr
|
115
|
+
ciphir
|
116
|
+
cifr
|
117
|
+
cifer
|
118
|
+
cifyr
|
119
|
+
cifir
|
120
|
+
cyphr
|
121
|
+
cypher
|
122
|
+
cyphyr
|
123
|
+
cyphir
|
124
|
+
cyfr
|
125
|
+
cyfer
|
126
|
+
cyfyr
|
127
|
+
cyfir
|
128
|
+
siphr
|
129
|
+
sipher
|
130
|
+
siphyr
|
131
|
+
siphir
|
132
|
+
sifr
|
133
|
+
sifer
|
134
|
+
sifyr
|
135
|
+
sifir
|
136
|
+
syphr
|
137
|
+
sypher
|
138
|
+
syphyr
|
139
|
+
syphir
|
140
|
+
syfr
|
141
|
+
syfer
|
142
|
+
syfyr
|
143
|
+
syfir
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
Gem::Specification.find_all.to_a.select{|s| s.dependencies.any?{|d| d.name=='slop'}}.map{|s| s.name}
|
149
|
+
https://codeclimate.com/github/cloudfoundry/vmc/VMC::Plugin/source_listing.js?line_end=53&line_start=11&path=lib%2Fvmc%2Fplugin.rb
|
150
|
+
https://github.com/mmozuras/pronto
|
151
|
+
http://stackoverflow.com/questions/11827950/create-an-extensible-ruby-gem
|
152
|
+
https://bitbucket.org/ged/strelka/src/dc4b6998813161ab4c94656ce144aa36a85ab65e/lib/strelka/discovery.rb
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
http://weblog.rubyonrails.org/2009/9/1/gem-packaging-best-practices/
|
158
|
+
https://gist.github.com/rtomayko/54177
|
159
|
+
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
11111111 | 11111111 | 11111111
|
164
|
+
111 | 111 | 111 | 111 | 111 | 111 | 111 | 111
|
165
|
+
|
166
|
+
1 2 3 4 5 6 7 8*1 2 3 4 5 6 7 8*1 2 3 4 5 6 7 8
|
167
|
+
1 2 3*1 2 3*1 2 3*1 2 3*1 2 3*1 2 3*1 2 3*1 2 3
|
168
|
+
|
169
|
+
|
170
|
+
~b64,hmac(abcd,~b64),b16,xor(deef,~b64)
|
171
|
+
~des
|
172
|
+
|
173
|
+
=abcd/^hex/b64/hmac[=abcd/^b64]=/
|
174
|
+
|
175
|
+
{abcd},~hex,b64/hmac-sha1[[{abcd},b64]]
|
176
|
+
|
177
|
+
=abcd ~hex hmac[=foo] ?key
|
178
|
+
|
179
|
+
~[],?@^#{}
|
180
|
+
|
181
|
+
|
182
|
+
0x01
|
183
|
+
|
184
|
+
|
185
|
+
|
186
|
+
foo#bar^baz[]
|
187
|
+
foo;bar|baz()
|
188
|
+
|
189
|
+
(foo|bar)|baz
|
190
|
+
|
191
|
+
((foo)|bar)|baz
|
192
|
+
|
193
|
+
assign var: ?varname
|
194
|
+
ref var: #varname
|
195
|
+
literal: =value
|
196
|
+
separator: " "
|
197
|
+
file reference: @filepath
|
198
|
+
|
199
|
+
% in url
|
200
|
+
used in b64: _-:!/.+=
|
201
|
+
shell ok: ~,.-_{}[]/?%#@^+=:
|
202
|
+
shell not ok: ()|!$&*\;'"<>`
|
203
|
+
|
204
|
+
sh b64
|
205
|
+
` x
|
206
|
+
~ x x
|
207
|
+
!
|
208
|
+
@ x x
|
209
|
+
# x x
|
210
|
+
$ x
|
211
|
+
% x x
|
212
|
+
^ x x
|
213
|
+
& x
|
214
|
+
* x
|
215
|
+
() x
|
216
|
+
- x
|
217
|
+
_ x
|
218
|
+
= x b
|
219
|
+
+ x
|
220
|
+
[] x x
|
221
|
+
{} x x
|
222
|
+
; x
|
223
|
+
: x
|
224
|
+
' x
|
225
|
+
" x
|
226
|
+
, x x
|
227
|
+
. x
|
228
|
+
/ x
|
229
|
+
<> x
|
230
|
+
? x x
|
231
|
+
|
232
|
+
|
233
|
+
|
234
|
+
x(a)|y(b)|z(c)
|
235
|
+
|
236
|
+
|
237
|
+
|
238
|
+
z
|
239
|
+
|
240
|
+
y c
|
241
|
+
|
242
|
+
x b
|
243
|
+
|
244
|
+
a
|
245
|
+
|
246
|
+
|
247
|
+
|
248
|
+
|
249
|
+
|
250
|
+
|
251
|
+
file
|
252
|
+
|
|
253
|
+
V
|
254
|
+
~hex
|
255
|
+
|
|
256
|
+
V
|
257
|
+
stdin --> aes --> hex --> stdout
|
258
|
+
|
259
|
+
|
260
|
+
file1 file2
|
261
|
+
| |
|
262
|
+
V V
|
263
|
+
~hex ~hex
|
264
|
+
| |
|
265
|
+
V V
|
266
|
+
stdin --> aes --> aes -> hex --> stdout
|
267
|
+
|
268
|
+
|
269
|
+
stdin --> md5 --> hex --> stdout
|
270
|
+
|
271
|
+
|
272
|
+
stdin --> md5 --> md5 --> ... -> md5 --> hex --> stdout
|
273
|
+
|
274
|
+
|
275
|
+
|
276
|
+
|
277
|
+
base64: read multiple loop
|
278
|
+
input.read(4) {|bytes,eof|
|
279
|
+
output.write(encode(bytes))
|
280
|
+
}
|
281
|
+
|
282
|
+
cipher: read full init, read arbitrary loop, special end
|
283
|
+
key.read() {|bytes,eof|
|
284
|
+
@bytes = bytes
|
285
|
+
}
|
286
|
+
input.read(256) {|bytes,eof|
|
287
|
+
output.write(cipher.update)
|
288
|
+
}
|
289
|
+
|
290
|
+
xor-repeat: read full init, read arbitrary loop
|
291
|
+
key.read() {|bytes,eof|}
|
292
|
+
|
293
|
+
|
294
|
+
xor-trunc: read arbitrary loop
|
295
|
+
key.read(1) && input.read(1) {
|
296
|
+
|
297
|
+
}
|
298
|
+
|
299
|
+
|
300
|
+
md5: read arbitrary loop, special end
|
301
|
+
|
302
|
+
hmac: read full init, read arbitrary loop, special end
|
303
|
+
|
304
|
+
def pump
|
305
|
+
if input.size >= 1 && key.size >= 1
|
306
|
+
output.write(input.read(1) ^ key.read(1))
|
307
|
+
end
|
308
|
+
end
|
309
|
+
|
310
|
+
|
311
|
+
|
312
|
+
IDEAS:
|
313
|
+
|
314
|
+
method_missing for arguments in function body
|
315
|
+
|
316
|
+
|
317
|
+
+ for concat
|
318
|
+
* for repeat
|
319
|
+
^ for recurse
|
320
|
+
|