rotp 6.2.0 → 6.2.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of rotp might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.devcontainer/Dockerfile +19 -0
- data/.devcontainer/devcontainer.json +37 -0
- data/.github/workflows/test.yaml +27 -0
- data/CHANGELOG.md +11 -0
- data/README.md +17 -4
- data/lib/rotp/otp.rb +0 -1
- data/lib/rotp/version.rb +1 -1
- metadata +6 -24
- data/.travis.yml +0 -9
- data/Dockerfile-2.5 +0 -10
- data/Dockerfile-2.6 +0 -11
- data/doc/ROTP/HOTP.html +0 -308
- data/doc/ROTP/OTP.html +0 -593
- data/doc/ROTP/TOTP.html +0 -493
- data/doc/Rotp.html +0 -179
- data/doc/_index.html +0 -144
- data/doc/class_list.html +0 -36
- data/doc/css/common.css +0 -1
- data/doc/css/full_list.css +0 -53
- data/doc/css/style.css +0 -310
- data/doc/file.README.html +0 -89
- data/doc/file_list.html +0 -38
- data/doc/frames.html +0 -13
- data/doc/index.html +0 -89
- data/doc/js/app.js +0 -203
- data/doc/js/full_list.js +0 -149
- data/doc/js/jquery.js +0 -154
- data/doc/method_list.html +0 -155
- data/doc/top-level-namespace.html +0 -88
data/doc/ROTP/OTP.html
DELETED
@@ -1,593 +0,0 @@
|
|
1
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
-
<head>
|
5
|
-
<meta name="Content-Type" content="text/html; charset=utf-8" />
|
6
|
-
<title>Class: ROTP::OTP</title>
|
7
|
-
<link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" charset="utf-8" />
|
8
|
-
<link rel="stylesheet" href="../css/common.css" type="text/css" media="screen" charset="utf-8" />
|
9
|
-
|
10
|
-
<script type="text/javascript" charset="utf-8">
|
11
|
-
relpath = '..';
|
12
|
-
if (relpath != '') relpath += '/';
|
13
|
-
</script>
|
14
|
-
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
15
|
-
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
16
|
-
|
17
|
-
</head>
|
18
|
-
<body>
|
19
|
-
<script type="text/javascript" charset="utf-8">
|
20
|
-
if (window.top.frames.main) document.body.className = 'frames';
|
21
|
-
</script>
|
22
|
-
|
23
|
-
<div id="header">
|
24
|
-
<div id="menu">
|
25
|
-
|
26
|
-
<a href="../_index.html">Index (O)</a> »
|
27
|
-
<span class='title'><span class='object_link'><a href="../ROTP.html" title="ROTP (module)">ROTP</a></span></span>
|
28
|
-
»
|
29
|
-
<span class="title">OTP</span>
|
30
|
-
|
31
|
-
|
32
|
-
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
33
|
-
</div>
|
34
|
-
|
35
|
-
<div id="search">
|
36
|
-
<a id="class_list_link" href="#">Class List</a>
|
37
|
-
<a id="method_list_link" href="#">Method List</a>
|
38
|
-
<a id ="file_list_link" href="#">File List</a>
|
39
|
-
</div>
|
40
|
-
|
41
|
-
<div class="clear"></div>
|
42
|
-
</div>
|
43
|
-
|
44
|
-
<iframe id="search_frame"></iframe>
|
45
|
-
|
46
|
-
<div id="content"><h1>Class: ROTP::OTP
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
</h1>
|
51
|
-
|
52
|
-
<dl class="box">
|
53
|
-
|
54
|
-
<dt class="r1">Inherits:</dt>
|
55
|
-
<dd class="r1">
|
56
|
-
<span class="inheritName">Object</span>
|
57
|
-
|
58
|
-
<ul class="fullTree">
|
59
|
-
<li>Object</li>
|
60
|
-
|
61
|
-
<li class="next">ROTP::OTP</li>
|
62
|
-
|
63
|
-
</ul>
|
64
|
-
<a href="#" class="inheritanceTree">show all</a>
|
65
|
-
|
66
|
-
</dd>
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
<dt class="r2 last">Defined in:</dt>
|
77
|
-
<dd class="r2 last">lib/rotp/otp.rb</dd>
|
78
|
-
|
79
|
-
</dl>
|
80
|
-
<div class="clear"></div>
|
81
|
-
|
82
|
-
<div id="subclasses">
|
83
|
-
<h2>Direct Known Subclasses</h2>
|
84
|
-
<p class="children"><span class='object_link'><a href="HOTP.html" title="ROTP::HOTP (class)">HOTP</a></span>, <span class='object_link'><a href="TOTP.html" title="ROTP::TOTP (class)">TOTP</a></span></p>
|
85
|
-
</div>
|
86
|
-
|
87
|
-
|
88
|
-
<h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
|
89
|
-
<ul class="summary">
|
90
|
-
|
91
|
-
<li class="public ">
|
92
|
-
<span class="summary_signature">
|
93
|
-
|
94
|
-
<a href="#digest-instance_method" title="#digest (instance method)">- (Object) <strong>digest</strong> </a>
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
</span>
|
99
|
-
|
100
|
-
|
101
|
-
<span class="note title readonly">readonly</span>
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
<span class="summary_desc"><div class='inline'><p>
|
111
|
-
Returns the value of attribute digest.
|
112
|
-
</p>
|
113
|
-
</div></span>
|
114
|
-
|
115
|
-
</li>
|
116
|
-
|
117
|
-
|
118
|
-
<li class="public ">
|
119
|
-
<span class="summary_signature">
|
120
|
-
|
121
|
-
<a href="#digits-instance_method" title="#digits (instance method)">- (Object) <strong>digits</strong> </a>
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
</span>
|
126
|
-
|
127
|
-
|
128
|
-
<span class="note title readonly">readonly</span>
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
<span class="summary_desc"><div class='inline'><p>
|
138
|
-
Returns the value of attribute digits.
|
139
|
-
</p>
|
140
|
-
</div></span>
|
141
|
-
|
142
|
-
</li>
|
143
|
-
|
144
|
-
|
145
|
-
<li class="public ">
|
146
|
-
<span class="summary_signature">
|
147
|
-
|
148
|
-
<a href="#secret-instance_method" title="#secret (instance method)">- (Object) <strong>secret</strong> </a>
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
</span>
|
153
|
-
|
154
|
-
|
155
|
-
<span class="note title readonly">readonly</span>
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
<span class="summary_desc"><div class='inline'><p>
|
165
|
-
Returns the value of attribute secret.
|
166
|
-
</p>
|
167
|
-
</div></span>
|
168
|
-
|
169
|
-
</li>
|
170
|
-
|
171
|
-
|
172
|
-
</ul>
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
<h2>
|
177
|
-
Instance Method Summary
|
178
|
-
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
179
|
-
</h2>
|
180
|
-
|
181
|
-
<ul class="summary">
|
182
|
-
|
183
|
-
<li class="public ">
|
184
|
-
<span class="summary_signature">
|
185
|
-
|
186
|
-
<a href="#byte_secret-instance_method" title="#byte_secret (instance method)">- (Object) <strong>byte_secret</strong> </a>
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
</span>
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
<span class="summary_desc"><div class='inline'></div></span>
|
200
|
-
|
201
|
-
</li>
|
202
|
-
|
203
|
-
|
204
|
-
<li class="public ">
|
205
|
-
<span class="summary_signature">
|
206
|
-
|
207
|
-
<a href="#generate_otp-instance_method" title="#generate_otp (instance method)">- (Object) <strong>generate_otp</strong>(count) </a>
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
</span>
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
<span class="summary_desc"><div class='inline'></div></span>
|
221
|
-
|
222
|
-
</li>
|
223
|
-
|
224
|
-
|
225
|
-
<li class="public ">
|
226
|
-
<span class="summary_signature">
|
227
|
-
|
228
|
-
<a href="#initialize-instance_method" title="#initialize (instance method)">- (OTP) <strong>initialize</strong>(s, options = {}) </a>
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
</span>
|
233
|
-
|
234
|
-
<span class="note title constructor">constructor</span>
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
<span class="summary_desc"><div class='inline'><p>
|
244
|
-
Params: secret in base32.
|
245
|
-
</p>
|
246
|
-
</div></span>
|
247
|
-
|
248
|
-
</li>
|
249
|
-
|
250
|
-
|
251
|
-
<li class="public ">
|
252
|
-
<span class="summary_signature">
|
253
|
-
|
254
|
-
<a href="#int_to_bytestring-instance_method" title="#int_to_bytestring (instance method)">- (Object) <strong>int_to_bytestring</strong>(int, padding = 8) </a>
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
</span>
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
<span class="summary_desc"><div class='inline'></div></span>
|
268
|
-
|
269
|
-
</li>
|
270
|
-
|
271
|
-
|
272
|
-
</ul>
|
273
|
-
|
274
|
-
|
275
|
-
<div id="constructor_details" class="method_details_list">
|
276
|
-
<h2>Constructor Details</h2>
|
277
|
-
|
278
|
-
<div class="method_details first">
|
279
|
-
<p class="signature first" id="initialize-instance_method">
|
280
|
-
|
281
|
-
- (<tt><span class='object_link'><a href="" title="ROTP::OTP (class)">OTP</a></span></tt>) <strong>initialize</strong>(s, options = {})
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
</p><div class="docstring">
|
286
|
-
<div class="discussion">
|
287
|
-
<p>
|
288
|
-
Params: secret in base32
|
289
|
-
</p>
|
290
|
-
|
291
|
-
|
292
|
-
</div>
|
293
|
-
</div>
|
294
|
-
<div class="tags">
|
295
|
-
|
296
|
-
</div><table class="source_code">
|
297
|
-
<tr>
|
298
|
-
<td>
|
299
|
-
<pre class="lines">
|
300
|
-
|
301
|
-
|
302
|
-
6
|
303
|
-
7
|
304
|
-
8
|
305
|
-
9
|
306
|
-
10</pre>
|
307
|
-
</td>
|
308
|
-
<td>
|
309
|
-
<pre class="code"><span class="info file"># File 'lib/rotp/otp.rb', line 6</span>
|
310
|
-
|
311
|
-
<span class='def def kw'>def</span> <span class='initialize identifier id'>initialize</span><span class='lparen token'>(</span><span class='s identifier id'>s</span><span class='comma token'>,</span> <span class='options identifier id'>options</span> <span class='assign token'>=</span> <span class='lbrace token'>{</span><span class='rbrace token'>}</span><span class='rparen token'>)</span>
|
312
|
-
<span class='@digits ivar id'>@digits</span> <span class='assign token'>=</span> <span class='options identifier id'>options</span><span class='lbrack token'>[</span><span class='symbol val'>:digits</span><span class='rbrack token'>]</span> <span class='orop op'>||</span> <span class='integer val'>6</span>
|
313
|
-
<span class='@digest ivar id'>@digest</span> <span class='assign token'>=</span> <span class='options identifier id'>options</span><span class='lbrack token'>[</span><span class='symbol val'>:digest</span><span class='rbrack token'>]</span> <span class='orop op'>||</span> <span class='string val'>"sha1"</span>
|
314
|
-
<span class='@secret ivar id'>@secret</span> <span class='assign token'>=</span> <span class='s identifier id'>s</span>
|
315
|
-
<span class='end end kw'>end</span>
|
316
|
-
</pre>
|
317
|
-
</td>
|
318
|
-
</tr>
|
319
|
-
</table>
|
320
|
-
</div>
|
321
|
-
|
322
|
-
</div>
|
323
|
-
|
324
|
-
<div id="instance_attr_details" class="attr_details">
|
325
|
-
<h2>Instance Attribute Details</h2>
|
326
|
-
|
327
|
-
|
328
|
-
<span id=""></span>
|
329
|
-
<span id="digest-instance_method"></span>
|
330
|
-
<div class="method_details first">
|
331
|
-
<p class="signature first" id="digest-instance_method">
|
332
|
-
|
333
|
-
- (<tt>Object</tt>) <strong>digest</strong> <span class="extras">(readonly)</span>
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
</p><div class="docstring">
|
338
|
-
<div class="discussion">
|
339
|
-
<p>
|
340
|
-
Returns the value of attribute digest
|
341
|
-
</p>
|
342
|
-
|
343
|
-
|
344
|
-
</div>
|
345
|
-
</div>
|
346
|
-
<div class="tags">
|
347
|
-
|
348
|
-
</div><table class="source_code">
|
349
|
-
<tr>
|
350
|
-
<td>
|
351
|
-
<pre class="lines">
|
352
|
-
|
353
|
-
|
354
|
-
3
|
355
|
-
4
|
356
|
-
5</pre>
|
357
|
-
</td>
|
358
|
-
<td>
|
359
|
-
<pre class="code"><span class="info file"># File 'lib/rotp/otp.rb', line 3</span>
|
360
|
-
|
361
|
-
<span class='def def kw'>def</span> <span class='digest identifier id'>digest</span>
|
362
|
-
<span class='@digest ivar id'>@digest</span>
|
363
|
-
<span class='end end kw'>end</span>
|
364
|
-
</pre>
|
365
|
-
</td>
|
366
|
-
</tr>
|
367
|
-
</table>
|
368
|
-
</div>
|
369
|
-
|
370
|
-
|
371
|
-
<span id=""></span>
|
372
|
-
<span id="digits-instance_method"></span>
|
373
|
-
<div class="method_details ">
|
374
|
-
<p class="signature " id="digits-instance_method">
|
375
|
-
|
376
|
-
- (<tt>Object</tt>) <strong>digits</strong> <span class="extras">(readonly)</span>
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
</p><div class="docstring">
|
381
|
-
<div class="discussion">
|
382
|
-
<p>
|
383
|
-
Returns the value of attribute digits
|
384
|
-
</p>
|
385
|
-
|
386
|
-
|
387
|
-
</div>
|
388
|
-
</div>
|
389
|
-
<div class="tags">
|
390
|
-
|
391
|
-
</div><table class="source_code">
|
392
|
-
<tr>
|
393
|
-
<td>
|
394
|
-
<pre class="lines">
|
395
|
-
|
396
|
-
|
397
|
-
3
|
398
|
-
4
|
399
|
-
5</pre>
|
400
|
-
</td>
|
401
|
-
<td>
|
402
|
-
<pre class="code"><span class="info file"># File 'lib/rotp/otp.rb', line 3</span>
|
403
|
-
|
404
|
-
<span class='def def kw'>def</span> <span class='digits identifier id'>digits</span>
|
405
|
-
<span class='@digits ivar id'>@digits</span>
|
406
|
-
<span class='end end kw'>end</span>
|
407
|
-
</pre>
|
408
|
-
</td>
|
409
|
-
</tr>
|
410
|
-
</table>
|
411
|
-
</div>
|
412
|
-
|
413
|
-
|
414
|
-
<span id=""></span>
|
415
|
-
<span id="secret-instance_method"></span>
|
416
|
-
<div class="method_details ">
|
417
|
-
<p class="signature " id="secret-instance_method">
|
418
|
-
|
419
|
-
- (<tt>Object</tt>) <strong>secret</strong> <span class="extras">(readonly)</span>
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
</p><div class="docstring">
|
424
|
-
<div class="discussion">
|
425
|
-
<p>
|
426
|
-
Returns the value of attribute secret
|
427
|
-
</p>
|
428
|
-
|
429
|
-
|
430
|
-
</div>
|
431
|
-
</div>
|
432
|
-
<div class="tags">
|
433
|
-
|
434
|
-
</div><table class="source_code">
|
435
|
-
<tr>
|
436
|
-
<td>
|
437
|
-
<pre class="lines">
|
438
|
-
|
439
|
-
|
440
|
-
3
|
441
|
-
4
|
442
|
-
5</pre>
|
443
|
-
</td>
|
444
|
-
<td>
|
445
|
-
<pre class="code"><span class="info file"># File 'lib/rotp/otp.rb', line 3</span>
|
446
|
-
|
447
|
-
<span class='def def kw'>def</span> <span class='secret identifier id'>secret</span>
|
448
|
-
<span class='@secret ivar id'>@secret</span>
|
449
|
-
<span class='end end kw'>end</span>
|
450
|
-
</pre>
|
451
|
-
</td>
|
452
|
-
</tr>
|
453
|
-
</table>
|
454
|
-
</div>
|
455
|
-
|
456
|
-
</div>
|
457
|
-
|
458
|
-
|
459
|
-
<div id="instance_method_details" class="method_details_list">
|
460
|
-
<h2>Instance Method Details</h2>
|
461
|
-
|
462
|
-
|
463
|
-
<div class="method_details first">
|
464
|
-
<p class="signature first" id="byte_secret-instance_method">
|
465
|
-
|
466
|
-
- (<tt>Object</tt>) <strong>byte_secret</strong>
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
</p><table class="source_code">
|
471
|
-
<tr>
|
472
|
-
<td>
|
473
|
-
<pre class="lines">
|
474
|
-
|
475
|
-
|
476
|
-
27
|
477
|
-
28
|
478
|
-
29</pre>
|
479
|
-
</td>
|
480
|
-
<td>
|
481
|
-
<pre class="code"><span class="info file"># File 'lib/rotp/otp.rb', line 27</span>
|
482
|
-
|
483
|
-
<span class='def def kw'>def</span> <span class='byte_secret identifier id'>byte_secret</span>
|
484
|
-
<span class='Base32 constant id'>Base32</span><span class='dot token'>.</span><span class='decode identifier id'>decode</span><span class='lparen token'>(</span><span class='@secret ivar id'>@secret</span><span class='rparen token'>)</span>
|
485
|
-
<span class='end end kw'>end</span>
|
486
|
-
</pre>
|
487
|
-
</td>
|
488
|
-
</tr>
|
489
|
-
</table>
|
490
|
-
</div>
|
491
|
-
|
492
|
-
<div class="method_details ">
|
493
|
-
<p class="signature " id="generate_otp-instance_method">
|
494
|
-
|
495
|
-
- (<tt>Object</tt>) <strong>generate_otp</strong>(count)
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
</p><table class="source_code">
|
500
|
-
<tr>
|
501
|
-
<td>
|
502
|
-
<pre class="lines">
|
503
|
-
|
504
|
-
|
505
|
-
12
|
506
|
-
13
|
507
|
-
14
|
508
|
-
15
|
509
|
-
16
|
510
|
-
17
|
511
|
-
18
|
512
|
-
19
|
513
|
-
20
|
514
|
-
21
|
515
|
-
22
|
516
|
-
23
|
517
|
-
24
|
518
|
-
25</pre>
|
519
|
-
</td>
|
520
|
-
<td>
|
521
|
-
<pre class="code"><span class="info file"># File 'lib/rotp/otp.rb', line 12</span>
|
522
|
-
|
523
|
-
<span class='def def kw'>def</span> <span class='generate_otp identifier id'>generate_otp</span><span class='lparen token'>(</span><span class='count identifier id'>count</span><span class='rparen token'>)</span>
|
524
|
-
<span class='hmac identifier id'>hmac</span> <span class='assign token'>=</span> <span class='OpenSSL constant id'>OpenSSL</span><span class='colon2 op'>::</span><span class='HMAC constant id'>HMAC</span><span class='dot token'>.</span><span class='digest identifier id'>digest</span><span class='lparen token'>(</span>
|
525
|
-
<span class='OpenSSL constant id'>OpenSSL</span><span class='colon2 op'>::</span><span class='Digest constant id'>Digest</span><span class='colon2 op'>::</span><span class='Digest constant id'>Digest</span><span class='dot token'>.</span><span class='new identifier id'>new</span><span class='lparen token'>(</span><span class='digest identifier id'>digest</span><span class='rparen token'>)</span><span class='comma token'>,</span>
|
526
|
-
<span class='byte_secret identifier id'>byte_secret</span><span class='comma token'>,</span>
|
527
|
-
<span class='int_to_bytestring identifier id'>int_to_bytestring</span><span class='lparen token'>(</span><span class='count identifier id'>count</span><span class='rparen token'>)</span>
|
528
|
-
<span class='rparen token'>)</span>
|
529
|
-
|
530
|
-
<span class='offset identifier id'>offset</span> <span class='assign token'>=</span> <span class='hmac identifier id'>hmac</span><span class='lbrack token'>[</span><span class='integer val'>19</span><span class='rbrack token'>]</span> <span class='bitand op'>&</span> <span class='integer val'>0xf</span>
|
531
|
-
<span class='code identifier id'>code</span> <span class='assign token'>=</span> <span class='lparen token'>(</span><span class='hmac identifier id'>hmac</span><span class='lbrack token'>[</span><span class='offset identifier id'>offset</span><span class='rbrack token'>]</span> <span class='bitand op'>&</span> <span class='integer val'>0x7f</span><span class='rparen token'>)</span> <span class='lshft op'><<</span> <span class='integer val'>24</span> <span class='bitor op'>|</span>
|
532
|
-
<span class='lparen token'>(</span><span class='hmac identifier id'>hmac</span><span class='lbrack token'>[</span><span class='offset identifier id'>offset</span> <span class='plus op'>+</span> <span class='integer val'>1</span><span class='rbrack token'>]</span> <span class='bitand op'>&</span> <span class='integer val'>0xff</span><span class='rparen token'>)</span> <span class='lshft op'><<</span> <span class='integer val'>16</span> <span class='bitor op'>|</span>
|
533
|
-
<span class='lparen token'>(</span><span class='hmac identifier id'>hmac</span><span class='lbrack token'>[</span><span class='offset identifier id'>offset</span> <span class='plus op'>+</span> <span class='integer val'>2</span><span class='rbrack token'>]</span> <span class='bitand op'>&</span> <span class='integer val'>0xff</span><span class='rparen token'>)</span> <span class='lshft op'><<</span> <span class='integer val'>8</span> <span class='bitor op'>|</span>
|
534
|
-
<span class='lparen token'>(</span><span class='hmac identifier id'>hmac</span><span class='lbrack token'>[</span><span class='offset identifier id'>offset</span> <span class='plus op'>+</span> <span class='integer val'>3</span><span class='rbrack token'>]</span> <span class='bitand op'>&</span> <span class='integer val'>0xff</span><span class='rparen token'>)</span>
|
535
|
-
<span class='code identifier id'>code</span> <span class='mod op'>%</span> <span class='integer val'>10</span> <span class='pow op'>**</span> <span class='digits identifier id'>digits</span>
|
536
|
-
<span class='end end kw'>end</span>
|
537
|
-
</pre>
|
538
|
-
</td>
|
539
|
-
</tr>
|
540
|
-
</table>
|
541
|
-
</div>
|
542
|
-
|
543
|
-
<div class="method_details ">
|
544
|
-
<p class="signature " id="int_to_bytestring-instance_method">
|
545
|
-
|
546
|
-
- (<tt>Object</tt>) <strong>int_to_bytestring</strong>(int, padding = 8)
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
</p><table class="source_code">
|
551
|
-
<tr>
|
552
|
-
<td>
|
553
|
-
<pre class="lines">
|
554
|
-
|
555
|
-
|
556
|
-
31
|
557
|
-
32
|
558
|
-
33
|
559
|
-
34
|
560
|
-
35
|
561
|
-
36
|
562
|
-
37
|
563
|
-
38</pre>
|
564
|
-
</td>
|
565
|
-
<td>
|
566
|
-
<pre class="code"><span class="info file"># File 'lib/rotp/otp.rb', line 31</span>
|
567
|
-
|
568
|
-
<span class='def def kw'>def</span> <span class='int_to_bytestring identifier id'>int_to_bytestring</span><span class='lparen token'>(</span><span class='int identifier id'>int</span><span class='comma token'>,</span> <span class='padding identifier id'>padding</span> <span class='assign token'>=</span> <span class='integer val'>8</span><span class='rparen token'>)</span>
|
569
|
-
<span class='result identifier id'>result</span> <span class='assign token'>=</span> <span class='lbrack token'>[</span><span class='rbrack token'>]</span>
|
570
|
-
<span class='until until kw'>until</span> <span class='int identifier id'>int</span> <span class='eq op'>==</span> <span class='integer val'>0</span>
|
571
|
-
<span class='result identifier id'>result</span> <span class='lshft op'><<</span> <span class='lparen token'>(</span><span class='int identifier id'>int</span> <span class='bitand op'>&</span> <span class='integer val'>0x</span><span class='FF constant id'>FF</span><span class='rparen token'>)</span><span class='dot token'>.</span><span class='chr identifier id'>chr</span>
|
572
|
-
<span class='int identifier id'>int</span> <span class='opasgn op'>>>=</span> <span class='integer val'>8</span>
|
573
|
-
<span class='end end kw'>end</span>
|
574
|
-
<span class='result identifier id'>result</span><span class='dot token'>.</span><span class='reverse identifier id'>reverse</span><span class='dot token'>.</span><span class='join identifier id'>join</span><span class='dot token'>.</span><span class='rjust identifier id'>rjust</span><span class='lparen token'>(</span><span class='integer val'>8</span><span class='comma token'>,</span> <span class='integer val'>0</span><span class='dot token'>.</span><span class='chr identifier id'>chr</span><span class='rparen token'>)</span>
|
575
|
-
<span class='end end kw'>end</span>
|
576
|
-
</pre>
|
577
|
-
</td>
|
578
|
-
</tr>
|
579
|
-
</table>
|
580
|
-
</div>
|
581
|
-
|
582
|
-
</div>
|
583
|
-
|
584
|
-
</div>
|
585
|
-
|
586
|
-
<div id="footer">
|
587
|
-
Generated on Sun Feb 13 12:31:40 2011 by
|
588
|
-
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
589
|
-
0.6.4 (ruby-1.8.7).
|
590
|
-
</div>
|
591
|
-
|
592
|
-
</body>
|
593
|
-
</html>
|