-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathTODO
320 lines (231 loc) · 5.96 KB
/
TODO
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
TODO:
==========================
Document use of bash anon named pipes with @ syntax
spaces in various places in grammar (between @ and filename, spaces inside of [] and () for calls)
xor hangs with large keyfiles
Context objects, Classes method_missing delegate to singleton instance
TTY handling: default trailing newline, colors/escapes for non-printable
tr, replace functions
interleave/concat multiple streams
vararg functions
switch endianness
fix
-----------
bug in b64 decoding of HFF= => HFE=
robustness
-----------
* graceful handling of mismatched data size (key size, base64 chunks, xor)
* errors for bad function name or args
* case insensitivity for ~b16
* high level classification of functions (util, bitwise, hash, cipher, mac, etc)
* handling of optional arguments (IVs/nonces, # rounds, etc) without breaking pipe argument prepending
* escape/encode non-printable chars if outputting to tty http://blog.bogojoker.com/2009/04/check-if-your-ruby-script-is-in-a-pipe/
* description for functions in help
completeness
-----------
base64 variants
* %/url, b32, ascii85, escape-sequence (\x, String.dump), xml/html
* bitwise ops: variants for mismatched lengths?
features
---------------
functions
bitwise ops
shift right/left (circular rotate vs fill)
not/and/or (similar to xor)
hashes
crc/adler
crypt/scrypt/bcrypt/pbkdf
ciphers
substitution: caeser/rot/dvorak/vigenère/affine/atbash/avgad/albam
physical: rotor/enigma
byte ops
prepend/append
indexed head/tail/substring
reverse bits/nibbles/bytes
repeat bytes
compression
gzip/deflate/lz*/bzip2/snappy/rle
http://en.wikipedia.org/wiki/Lempel%E2%80%93Ziv
generators
random bytes
revamp streams
http://readruby.io/io
https://github.com/javanthropus/io-like
https://github.com/javanthropus/stream
https://github.com/rubygems/rubygems/blob/master/lib/rubygems/package/digest_io.rb
https://github.com/krypt/binyo
https://gist.github.com/tlrobinson/967710
https://www.ruby-forum.com/topic/58563
https://github.com/jdleesmiller/event_state
https://github.com/slagyr/statemachine/
namespacing in case of simple name collisions
string literals
alternative quotes (a la ruby/perl/python, %q[] %Q{} qq() """ ''') http://en.wikibooks.org/wiki/Ruby_Programming/Alternate_quotes
allow \xXX escaping
extension mechanism (via other gems or simple files)
varargs for functions
non pipe statements variable writing/reading
random ideas
-------------
`strings` extraction
regex search/replace support
fn for executing shell/ruby
multi-round hash support
cleanliness
-----------
refactor variable buffering (probably will improve perf)
break up functions
goals and philosophy
==========================
functions on streams of bytes
kiss: crypto, hashes, bitwise ops, encodings, compression, simple transforms
most complex use case: generate rails cookie from marshalled data and secret
strive for streaming impls and low memory usage even for large input documents
pull/read (vs push/write) based API
shell friendly syntax
maximum portability, no native gem deps
extensible via external gems adding functions
scratch notes
==========================
reverse(input,chunksize=1,boundarysize=nil)
cat(input1,input2,...,inputn)
ruby -e 'puts ["c","s"].product(["i","y"]).product(["ph","f"]).product(["r","er","yr","ir"]).map{|a| a.flatten.join}'
ciphr
cipher
ciphyr
ciphir
cifr
cifer
cifyr
cifir
cyphr
cypher
cyphyr
cyphir
cyfr
cyfer
cyfyr
cyfir
siphr
sipher
siphyr
siphir
sifr
sifer
sifyr
sifir
syphr
sypher
syphyr
syphir
syfr
syfer
syfyr
syfir
Gem::Specification.find_all.to_a.select{|s| s.dependencies.any?{|d| d.name=='slop'}}.map{|s| s.name}
https://codeclimate.com/github/cloudfoundry/vmc/VMC::Plugin/source_listing.js?line_end=53&line_start=11&path=lib%2Fvmc%2Fplugin.rb
https://github.com/mmozuras/pronto
http://stackoverflow.com/questions/11827950/create-an-extensible-ruby-gem
https://bitbucket.org/ged/strelka/src/dc4b6998813161ab4c94656ce144aa36a85ab65e/lib/strelka/discovery.rb
http://weblog.rubyonrails.org/2009/9/1/gem-packaging-best-practices/
https://gist.github.com/rtomayko/54177
11111111 | 11111111 | 11111111
111 | 111 | 111 | 111 | 111 | 111 | 111 | 111
1 2 3 4 5 6 7 8*1 2 3 4 5 6 7 8*1 2 3 4 5 6 7 8
1 2 3*1 2 3*1 2 3*1 2 3*1 2 3*1 2 3*1 2 3*1 2 3
~b64,hmac(abcd,~b64),b16,xor(deef,~b64)
~des
=abcd/^hex/b64/hmac[=abcd/^b64]=/
{abcd},~hex,b64/hmac-sha1[[{abcd},b64]]
=abcd ~hex hmac[=foo] ?key
~[],?@^#{}
0x01
foo#bar^baz[]
foo;bar|baz()
(foo|bar)|baz
((foo)|bar)|baz
assign var: ?varname
ref var: #varname
literal: =value
separator: " "
file reference: @filepath
% in url
used in b64: _-:!/.+=
shell ok: ~,.-_{}[]/?%#@^+=:
shell not ok: ()|!$&*\;'"<>`
sh b64
` x
~ x x
!
@ x x
# x x
$ x
% x x
^ x x
& x
* x
() x
- x
_ x
= x b
+ x
[] x x
{} x x
; x
: x
' x
" x
, x x
. x
/ x
<> x
? x x
x(a)|y(b)|z(c)
z
y c
x b
a
file
|
V
~hex
|
V
stdin --> aes --> hex --> stdout
file1 file2
| |
V V
~hex ~hex
| |
V V
stdin --> aes --> aes -> hex --> stdout
stdin --> md5 --> hex --> stdout
stdin --> md5 --> md5 --> ... -> md5 --> hex --> stdout
base64: read multiple loop
input.read(4) {|bytes,eof|
output.write(encode(bytes))
}
cipher: read full init, read arbitrary loop, special end
key.read() {|bytes,eof|
@bytes = bytes
}
input.read(256) {|bytes,eof|
output.write(cipher.update)
}
xor-repeat: read full init, read arbitrary loop
key.read() {|bytes,eof|}
xor-trunc: read arbitrary loop
key.read(1) && input.read(1) {
}
md5: read arbitrary loop, special end
hmac: read full init, read arbitrary loop, special end
def pump
if input.size >= 1 && key.size >= 1
output.write(input.read(1) ^ key.read(1))
end
end
IDEAS:
method_missing for arguments in function body
+ for concat
* for repeat
^ for recurse