crypt-isaac 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 32721d59c293f47c17f554ec6d614a3dd6d9c223
4
- data.tar.gz: 3b0bf2597824aa9e730ee2d314e96fbe028d489f
3
+ metadata.gz: feef9d004fecdb9e9f3939c7999187e53557b961
4
+ data.tar.gz: 649862bed95c38ca659cb981ac03c775d6fb87a3
5
5
  SHA512:
6
- metadata.gz: b43a59b1dffaf4f1326081fe7b4f935ad4ecb478c17e23d8f637d8e03f2d9a7166964f750eb93953e298ecb0d57754d0ad98d2524c316f0d20d09b2d0d66e7db
7
- data.tar.gz: 9313d7ac00934839290713cef9b2c6a5cb13da38b1c21eaf7a0bfc5f4838860777516c8416f086fb7ec0d05c83d99c75f60cd27b3bd5319f47c11137f2d3b803
6
+ metadata.gz: 2be54dd7d4776b9509b9537fd6008b8a9bae622d4f2774ba53dd4d237e5befe69ba08173eebed1d9d57c436f8822376d956d20c3362a09c78fdf8a006e47afc6
7
+ data.tar.gz: 9979cb410ddc9be97eda6eeffa4134546fe4e54e90b6c27f629be194871db4fc4556304dad51d62e327146f0af380f3165430157672d6dfa29bdd131b08029aa
@@ -0,0 +1,22 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ crypt-isaac (1.2.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ minitest
10
+ rake (11.3.0)
11
+
12
+ PLATFORMS
13
+ ruby
14
+
15
+ DEPENDENCIES
16
+ bundler (~> 1.10)
17
+ crypt-isaac!
18
+ minitest (> 0)
19
+ rake (~> 11.0)
20
+
21
+ BUNDLED WITH
22
+ 1.13.1
data/Rakefile CHANGED
@@ -2,17 +2,22 @@ require "bundler/gem_tasks"
2
2
  require "rake/testtask"
3
3
  require "rake/extensiontask"
4
4
 
5
- Rake::ExtensionTask.new "isaac" do |ext|
6
- ext.lib_dir = "lib/crypt/"
5
+ Rake::ExtensionTask.new "isaac/ext" do |ext|
6
+ # ext.name = "ext"
7
+ ext.ext_dir = "ext/crypt/isaac"
8
+ ext.lib_dir = "ext/crypt/"
7
9
  end
8
10
 
9
- Rake::ExtensionTask.new "xorshift" do |ext|
10
- ext.lib_dir = "lib/crypt/xorshift"
11
+ Rake::ExtensionTask.new "isaac/xorshift/ext" do |ext|
12
+ # ext.name = "ext"
13
+ ext.ext_dir = "ext/crypt/isaac/xorshift"
14
+ ext.lib_dir = "ext/crypt/"
11
15
  end
12
16
 
13
17
  Rake::TestTask.new(:test) do |t|
14
18
  t.libs << "test"
15
19
  t.libs << "lib"
20
+ t.libs << "ext"
16
21
  t.test_files = FileList['test/**/*_test.rb']
17
22
  end
18
23
 
@@ -29,6 +29,6 @@ Gem::Specification.new do |spec|
29
29
  spec.require_paths = ["lib"]
30
30
 
31
31
  spec.add_development_dependency "bundler", "~> 1.10"
32
- spec.add_development_dependency "rake", "~> 10.0"
32
+ spec.add_development_dependency "rake", "~> 11.0"
33
33
  spec.add_development_dependency "minitest"
34
34
  end
@@ -3,43 +3,22 @@
3
3
 
4
4
  static VALUE CryptModule;
5
5
  static VALUE ISAACClass;
6
+ static VALUE DEFAULT;
6
7
 
7
- static void ISAAC_free( randctx* ctx ) {
8
- if ( ctx ) {
9
- xfree( ctx );
10
- }
11
- }
12
-
13
- static VALUE ISAAC_alloc( VALUE klass ) {
14
- randctx *ctx;
15
-
16
- return Data_Make_Struct( klass, randctx, NULL, ISAAC_free, ctx );
17
- }
18
-
19
- static VALUE ISAAC_initialize( VALUE self, VALUE args ) {
20
- VALUE _seed ;
8
+ static VALUE ISAAC_class_new_seed( VALUE self, VALUE args ) {
9
+ int x;
21
10
  long len = RARRAY_LEN( args );
22
- if ( len == 0 ) {
23
- _seed = Qtrue;
24
- } else {
25
- _seed = rb_ary_entry( args, 0 );
26
- }
27
-
28
- return rb_funcall( self, rb_intern( "srand" ), 1, _seed );
29
- }
30
-
31
- static VALUE ISAAC_srand( VALUE self, VALUE args ) {
32
- FILE *fh;
33
- uint32_t num = 0;
34
11
  size_t nread;
12
+ uint32_t num = 0;
13
+ FILE *fh;
35
14
  VALUE _seed;
36
- VALUE old_seed;
37
15
  VALUE seed_prng;
38
16
  VALUE random_argv[1];
39
17
  VALUE rnd_source = Qnil;
40
- int x;
41
- long len = RARRAY_LEN( args );
42
- randctx *ctx;
18
+ VALUE new_seed = rb_ary_new();
19
+ VALUE zero = INT2NUM( 0 );
20
+
21
+ for (x = RANDSIZ - 1; x >= 0; x--) { rb_ary_push( new_seed, zero ); }
43
22
 
44
23
  if ( len == 0 ) {
45
24
  _seed = Qtrue;
@@ -51,10 +30,16 @@ static VALUE ISAAC_srand( VALUE self, VALUE args ) {
51
30
  rnd_source = ( _seed == Qtrue ) ? rb_str_new2("/dev/urandom") : rb_str_new2("/dev/random");
52
31
  }
53
32
 
54
- Data_Get_Struct( self, randctx, ctx );
55
- MEMZERO( ctx, randctx, 1 );
56
-
57
- if ( ( rnd_source != Qnil ) && ( rb_funcall( rb_mFileTest, rb_intern("exist?"), 1, rnd_source ) == Qtrue ) ) {
33
+ if ( rb_funcall( _seed, rb_intern( "respond_to?" ), 1, ID2SYM( rb_intern("each") ) ) == Qtrue ) {
34
+ for (
35
+ x = ( NUM2INT( rb_funcall( _seed, rb_intern( "length" ), 0, NULL ) ) > (RANDSIZ - 1) ?
36
+ ( RANDSIZ - 1 ) : NUM2INT( rb_funcall( _seed, rb_intern( "length" ), 0, NULL ) ) );
37
+ x >= 0;
38
+ x--
39
+ ) {
40
+ rb_ary_store( new_seed, x, rb_ary_entry( _seed, x ) );
41
+ }
42
+ } else if ( ( rnd_source != Qnil ) && ( rb_funcall( rb_mFileTest, rb_intern("exist?"), 1, rnd_source ) == Qtrue ) ) {
58
43
  fh = fopen("/dev/urandom","r");
59
44
  for ( x = RANDSIZ - 1; x >= 0; x-- ) {
60
45
  nread = fread(&num, sizeof(uint32_t), 1, fh);
@@ -62,42 +47,115 @@ static VALUE ISAAC_srand( VALUE self, VALUE args ) {
62
47
  x++;
63
48
  continue;
64
49
  }
65
- ctx->randrsl[x] = num;
50
+ rb_ary_store( new_seed, x, LONG2NUM(num) );
66
51
  }
67
52
  fclose(fh);
68
53
  } else {
69
54
  if ( rnd_source != Qnil ) {
70
55
  _seed = Qnil;
71
56
  }
72
- if ( rb_funcall( _seed, rb_intern( "respond_to?" ), 1, rb_str_new2("rand") ) == Qtrue ) {
57
+ if ( rb_funcall( _seed, rb_intern( "respond_to?" ), 1, ID2SYM( rb_intern("rand") ) ) == Qtrue ) {
73
58
  seed_prng = _seed;
74
59
  } else {
75
60
  random_argv[0] = _seed;
76
61
  seed_prng = rb_class_new_instance( 1, random_argv, rb_const_get( rb_const_get( rb_cObject, rb_intern( "Crypt" ) ), rb_intern( "Xorshift64Star" ) ) );
77
62
  _seed = rb_funcall( seed_prng, rb_intern( "seed" ), 0 );
78
- rb_iv_set( self, "@seed_prng", seed_prng );
79
63
  }
80
64
  for ( x = RANDSIZ - 1; x >= 0; x-- ) {
81
- ctx->randrsl[x] = FIX2ULONG( rb_funcall( seed_prng, rb_intern( "rand" ), 1, ULONG2NUM(4294967296) ) );
65
+ rb_ary_store( new_seed, x, rb_funcall( seed_prng, rb_intern( "rand" ), 1, ULONG2NUM(4294967296) ) );
82
66
  }
83
67
  }
84
- randinit(ctx, 1);
85
68
 
86
- rb_iv_set( self, "@seed", ( ( rnd_source == Qtrue ) || ( rnd_source == Qfalse ) ) ? rnd_source : _seed );
69
+ return new_seed;
70
+ }
71
+
72
+ static void ISAAC_free( randctx* ctx ) {
73
+ if ( ctx ) {
74
+ xfree( ctx );
75
+ }
76
+ }
77
+
78
+ static VALUE ISAAC_alloc( VALUE klass ) {
79
+ randctx *ctx;
80
+
81
+ return Data_Make_Struct( klass, randctx, NULL, ISAAC_free, ctx );
82
+ }
83
+
84
+ static VALUE ISAAC_initialize( VALUE self, VALUE args ) {
85
+ long len = RARRAY_LEN( args );
86
+ VALUE _seed ;
87
+
88
+ if ( len == 0 ) {
89
+ _seed = Qtrue;
90
+ } else {
91
+ _seed = rb_ary_entry( args, 0 );
92
+ }
93
+
94
+ rb_iv_set( self, "@seed", Qnil );
95
+ return rb_funcall( self, rb_intern( "srand" ), 1, _seed );
96
+ }
97
+
98
+ static VALUE ISAAC_copy( VALUE self, VALUE from ) {
99
+ int x;
100
+ randctx *self_ctx;
101
+ randctx *from_ctx;
102
+
103
+ Data_Get_Struct( self, randctx, self_ctx );
104
+ Data_Get_Struct( from, randctx, from_ctx );
105
+
106
+ self_ctx->randcnt = from_ctx->randcnt;
107
+ self_ctx->randa = from_ctx->randa;
108
+ self_ctx->randb = from_ctx->randb;
109
+ self_ctx->randc = from_ctx->randc;
110
+ for ( x = RANDSIZ - 1; x >= 0; x-- ) {
111
+ self_ctx->randrsl[x] = from_ctx->randrsl[x];
112
+ self_ctx->randmem[x] = from_ctx->randmem[x];
113
+ }
114
+
115
+ return self;
116
+ }
117
+
118
+ static VALUE ISAAC_srand( VALUE self, VALUE args ) {
119
+ int x;
120
+ long len = RARRAY_LEN( args );
121
+ randctx *ctx;
122
+ VALUE new_seed;
123
+ VALUE old_seed;
124
+ VALUE _seed;
125
+
126
+ if ( len == 0 ) {
127
+ _seed = Qtrue;
128
+ } else {
129
+ _seed = rb_ary_entry( args, 0 );
130
+ }
131
+
132
+ new_seed = rb_funcall( rb_obj_class( self ), rb_intern( "new_seed" ), 1, _seed );
87
133
  old_seed = rb_iv_get( self, "@seed");
134
+ rb_iv_set( self, "@seed", rb_ary_dup( new_seed ) );
135
+
136
+ Data_Get_Struct( self, randctx, ctx );
137
+ MEMZERO( ctx, randctx, 1 );
138
+ for ( x = RANDSIZ - 1; x >= 0; x-- ) {
139
+ ctx->randrsl[x] = FIX2ULONG( rb_ary_entry( new_seed, x ) );
140
+ }
141
+ randinit(ctx, 1);
88
142
 
89
143
  return old_seed;
90
144
  }
91
145
 
146
+ static VALUE ISAAC_class_srand( VALUE self, VALUE args) {
147
+ return ISAAC_srand( DEFAULT, args );
148
+ }
149
+
92
150
  static VALUE ISAAC_rand( VALUE self, VALUE args ) {
93
- uint32_t limit;
94
151
  long len = RARRAY_LEN( args );
95
- VALUE arg;
96
152
  short arg_is_a_range = 0;
153
+ uint32_t limit;
154
+ randctx *ctx;
155
+ ID id_max;
97
156
  ID id_min;
157
+ VALUE arg;
98
158
  VALUE val_min = 0;
99
- ID id_max;
100
- randctx *ctx;
101
159
 
102
160
  arg = rb_ary_entry( args, 0 );
103
161
 
@@ -128,10 +186,14 @@ static VALUE ISAAC_rand( VALUE self, VALUE args ) {
128
186
  }
129
187
  }
130
188
 
189
+ static VALUE ISAAC_class_rand( VALUE self, VALUE args) {
190
+ return ISAAC_rand( DEFAULT, args );
191
+ }
192
+
131
193
  static VALUE ISAAC_marshal_dump( VALUE self ) {
132
- randctx *ctx;
133
- int i;
134
194
  int ary_size = sizeof( randctx ) / sizeof( ub4 );
195
+ int i;
196
+ randctx *ctx;
135
197
  VALUE ary;
136
198
 
137
199
  Data_Get_Struct( self, randctx, ctx );
@@ -145,9 +207,9 @@ static VALUE ISAAC_marshal_dump( VALUE self ) {
145
207
  }
146
208
 
147
209
  static VALUE ISAAC_marshal_load( VALUE self, VALUE ary ) {
148
- randctx *ctx;
149
- int i;
150
210
  int ary_size = sizeof( randctx ) / sizeof( ub4 );
211
+ int i;
212
+ randctx *ctx;
151
213
 
152
214
  Data_Get_Struct( self, randctx, ctx );
153
215
 
@@ -165,12 +227,9 @@ static VALUE ISAAC_seed( VALUE self ) {
165
227
  return rb_iv_get( self, "@seed");
166
228
  }
167
229
 
168
- static VALUE ISAAC_new_seed( VALUE self ) {
169
- return rb_funcall( rb_iv_get( self, "@seed_prng" ), rb_intern("new_seed"), 0 );
170
- }
171
-
172
230
  int compare_ctx( randctx* ctx1, randctx* ctx2 ) {
173
231
  int x;
232
+
174
233
  for ( x = RANDSIZ - 1; x >= 0; x-- ) {
175
234
  if ( ctx1->randrsl[x] != ctx2->randrsl[x] ) return 0;
176
235
  }
@@ -202,7 +261,6 @@ static VALUE ISAAC_bytes( VALUE self, VALUE count ) {
202
261
  ctx->randcnt = RANDSIZ - 1;
203
262
  }
204
263
 
205
- // snprintf( &buf[ i ], 5, "%lu", ctx->randrsl[ctx->randcnt] );
206
264
  buf[ i ] = ctx->randrsl[ctx->randcnt];
207
265
  buf[ i + 1 ] = ctx->randrsl[ctx->randcnt] >> 8;
208
266
  buf[ i + 2 ] = ctx->randrsl[ctx->randcnt] >> 16;
@@ -215,18 +273,25 @@ static VALUE ISAAC_bytes( VALUE self, VALUE count ) {
215
273
  void Init_ext() {
216
274
  CryptModule = rb_define_module( "Crypt" );
217
275
  ISAACClass = rb_define_class_under( CryptModule, "ISAAC", rb_cObject );
218
-
276
+
277
+ rb_define_singleton_method( ISAACClass, "rand", ISAAC_class_rand, -2 );
278
+ rb_define_singleton_method( ISAACClass, "srand", ISAAC_class_srand, -2 );
279
+ rb_define_singleton_method( ISAACClass, "new_seed", ISAAC_class_new_seed, -2 );
280
+
219
281
  rb_define_alloc_func( ISAACClass, ISAAC_alloc );
220
282
  rb_define_method( ISAACClass, "initialize", ISAAC_initialize, -2 );
221
283
  rb_define_method( ISAACClass, "srand", ISAAC_srand, -2 );
222
284
  rb_define_method( ISAACClass, "rand", ISAAC_rand, -2 );
223
285
  rb_define_method( ISAACClass, "seed", ISAAC_seed, 0 );
224
- rb_define_method( ISAACClass, "new_seed", ISAAC_new_seed, 0 );
225
286
  rb_define_method( ISAACClass, "==", ISAAC_eq, 1 );
226
287
  rb_define_method( ISAACClass, "bytes", ISAAC_bytes, 1 );
227
- rb_define_method( ISAACClass, "marshal_dump", ISAAC_marshal_dump, 0 );
228
- rb_define_method( ISAACClass, "marshal_load", ISAAC_marshal_load, 1 );
288
+ rb_define_method( ISAACClass, "initialize_copy", ISAAC_copy, 1 );
289
+ rb_define_private_method( ISAACClass, "marshal_dump", ISAAC_marshal_dump, 0 );
290
+ rb_define_private_method( ISAACClass, "marshal_load", ISAAC_marshal_load, 1 );
229
291
 
230
- rb_const_set( ISAACClass, rb_intern("RANDSIZ"), ULONG2NUM(RANDSIZ) );
292
+ rb_const_set( ISAACClass, rb_intern( "RANDSIZ" ), ULONG2NUM(RANDSIZ) );
293
+ rb_const_set( ISAACClass, rb_intern( "DEFAULT" ), rb_class_new_instance( 0, 0, ISAACClass ) );
294
+ DEFAULT = rb_const_get( ISAACClass, rb_intern( "DEFAULT" ) );
295
+
231
296
  rb_require( "crypt/isaac/version.rb" );
232
297
  }
@@ -8,7 +8,7 @@ begin
8
8
  # Use a non-cryptographic alternative to the Mersenne Twister for an internal
9
9
  # pseudo-random source of numbers if the library is required to seed itself.
10
10
  # https://en.wikipedia.org/wiki/Xorshift
11
- require 'crypt-xorshift'
11
+ require 'crypt/xorshift'
12
12
  rescue LoadError
13
13
  # Fallback on an internal micro-implementation.
14
14
  require 'crypt/isaac/xorshift'
@@ -25,32 +25,31 @@ module Crypt
25
25
  # xorshift* generator, but anything that responds to #rand can be passed
26
26
  # as a seed.
27
27
 
28
- def initialize(seed = true)
29
- @mm = []
28
+ def self.rand( arg = nil )
29
+ DEFAULT.rand( arg )
30
+ end
30
31
 
31
- self.srand( seed )
32
+ def self.srand( seed = true )
33
+ DEFAULT.srand( seed )
32
34
  end
33
35
 
34
- # If seeded with an integer, use that to seed a standard Ruby Mersenne Twister
35
- # PRNG, and then use that to generate seed value for ISAAC. This is mostly useful
36
- # for producing repeated, deterministic results, which may be needed for testing.
37
- def srand(seed = true)
36
+ def self.new_seed( seed = true )
37
+ seed_array = Array.new( 256, 0)
38
38
  rnd_source = nil
39
39
  rnd_source = seed ? '/dev/urandom' : '/dev/random' if ( ( seed == true ) || ( seed == false ) )
40
- if rnd_source && ( FileTest.exist? rnd_source )
41
- @randrsl = []
40
+ if ( seed.respond_to?(:each) )
41
+ ( seed.length > 255 ? 256 : seed.length ).times {|s| seed_array[s] = seed[s] }
42
+ elsif rnd_source && ( FileTest.exist? rnd_source )
42
43
  File.open( rnd_source, 'r' ) do |r|
43
44
  256.times do |t|
44
45
  z = r.read(4)
45
46
  x = z.unpack('V')[0]
46
- @randrsl[t] = x
47
+ seed_array[t] = x
47
48
  end
48
49
  end
49
- randinit( true )
50
50
  else
51
51
  seed = nil if rnd_source
52
52
 
53
- @randrsl = []
54
53
  if seed.respond_to?( :rand )
55
54
  seed_prng = seed
56
55
  else
@@ -58,10 +57,37 @@ module Crypt
58
57
  end
59
58
 
60
59
  256.times do |t|
61
- @randrsl[t] = seed_prng.rand(4294967296)
60
+ seed_array[t] = seed_prng.rand(4294967296)
62
61
  end
63
- randinit(true)
64
62
  end
63
+ seed_array
64
+ end
65
+
66
+ def initialize(seed = true)
67
+ @mm = []
68
+
69
+ self.srand( seed )
70
+ end
71
+
72
+ def initialize_copy( from )
73
+ @aa = from.aa
74
+ @bb = from.bb
75
+ @cc = from.cc
76
+ @mm = from.mm.dup
77
+ @randcnt = from.randcnt
78
+ @randrsl = from.randrsl.dup
79
+
80
+ self
81
+ end
82
+
83
+ # If seeded with an integer, use that to seed a standard Ruby Mersenne Twister
84
+ # PRNG, and then use that to generate seed value for ISAAC. This is mostly useful
85
+ # for producing repeated, deterministic results, which may be needed for testing.
86
+ def srand(seed = true)
87
+ @randrsl = self.class.new_seed( seed )
88
+ @seed = @randrsl.dup
89
+ randinit(true)
90
+ @seed
65
91
  end
66
92
 
67
93
  # Works just like the standard rand() function. If called with an
@@ -78,17 +104,17 @@ module Crypt
78
104
  @randcnt -= 1
79
105
  if arg.nil?
80
106
  ( @randrsl[@randcnt] / 536870912.0 ) % 1
81
- elsif Integer === arg || Float === arg
107
+ elsif Integer === arg
82
108
  @randrsl[@randcnt] % arg
83
109
  elsif Range === arg
84
110
  arg.min + @randrsl[@randcnt] % (arg.max - arg.min)
85
111
  else
86
- @randrsl[@randcnt] % Integer(arg)
112
+ @randrsl[@randcnt] % arg.to_i
87
113
  end
88
114
  end
89
115
 
90
116
  def seed
91
- @seed.respond_to?(:seed) ? @seed.seed : @seed
117
+ @seed
92
118
  end
93
119
 
94
120
  def state
@@ -117,7 +143,7 @@ module Crypt
117
143
 
118
144
  @cc += 1
119
145
  @bb += @cc
120
- @bb & 0xffffffff
146
+ @bb = @bb & 0xffffffff
121
147
 
122
148
  while (i < 256) do
123
149
  x = @mm[i]
@@ -214,5 +240,9 @@ module Crypt
214
240
  isaac()
215
241
  @randcnt=256; # /* prepare to use the first set of results */
216
242
  end
243
+
244
+ DEFAULT = ISAAC.new
245
+
246
+
217
247
  end
218
248
  end
@@ -1,5 +1,5 @@
1
1
  module Crypt
2
2
  module Isaac
3
- VERSION = "1.1.0"
3
+ VERSION = "1.2.0"
4
4
  end
5
5
  end
@@ -8,8 +8,9 @@ module Crypt
8
8
  UINT64_Cf = UINT64_C.to_f
9
9
 
10
10
  def initialize( seed = new_seed )
11
+ @seed = nil
11
12
  srand( seed )
12
- @old_seed = @seed
13
+ @old_seed = seed
13
14
  end
14
15
 
15
16
  def new_seed
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: crypt-isaac
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kirk Haines
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-10-04 00:00:00.000000000 Z
11
+ date: 2016-11-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '10.0'
33
+ version: '11.0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '10.0'
40
+ version: '11.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: minitest
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -67,13 +67,13 @@ extra_rdoc_files: []
67
67
  files:
68
68
  - CODE_OF_CONDUCT.md
69
69
  - Gemfile
70
+ - Gemfile.lock
70
71
  - LICENSE.txt
71
72
  - README.md
72
73
  - Rakefile
73
74
  - bin/console
74
75
  - bin/setup
75
76
  - crypt-isaac.gemspec
76
- - ext/crypt/isaac/Makefile
77
77
  - ext/crypt/isaac/extconf.rb
78
78
  - ext/crypt/isaac/isaac.c
79
79
  - ext/crypt/isaac/rand.c
@@ -107,7 +107,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
107
107
  version: '0'
108
108
  requirements: []
109
109
  rubyforge_project:
110
- rubygems_version: 2.5.1
110
+ rubygems_version: 2.5.2
111
111
  signing_key:
112
112
  specification_version: 4
113
113
  summary: An implementation of the fast, cryptographically secure ISAAC PRNG
@@ -1,260 +0,0 @@
1
-
2
- SHELL = /bin/sh
3
-
4
- # V=0 quiet, V=1 verbose. other values don't work.
5
- V = 0
6
- Q1 = $(V:1=)
7
- Q = $(Q1:0=@)
8
- ECHO1 = $(V:1=@:)
9
- ECHO = $(ECHO1:0=@echo)
10
- NULLCMD = :
11
-
12
- #### Start of system configuration section. ####
13
-
14
- srcdir = .
15
- topdir = /home/wyhaines/.rvm/rubies/ruby-2.3.1/include/ruby-2.3.0
16
- hdrdir = $(topdir)
17
- arch_hdrdir = /home/wyhaines/.rvm/rubies/ruby-2.3.1/include/ruby-2.3.0/x86_64-linux
18
- PATH_SEPARATOR = :
19
- VPATH = $(srcdir):$(arch_hdrdir)/ruby:$(hdrdir)/ruby
20
- prefix = $(DESTDIR)/home/wyhaines/.rvm/rubies/ruby-2.3.1
21
- rubysitearchprefix = $(rubylibprefix)/$(sitearch)
22
- rubyarchprefix = $(rubylibprefix)/$(arch)
23
- rubylibprefix = $(libdir)/$(RUBY_BASE_NAME)
24
- exec_prefix = $(prefix)
25
- vendorarchhdrdir = $(vendorhdrdir)/$(sitearch)
26
- sitearchhdrdir = $(sitehdrdir)/$(sitearch)
27
- rubyarchhdrdir = $(rubyhdrdir)/$(arch)
28
- vendorhdrdir = $(rubyhdrdir)/vendor_ruby
29
- sitehdrdir = $(rubyhdrdir)/site_ruby
30
- rubyhdrdir = $(includedir)/$(RUBY_VERSION_NAME)
31
- vendorarchdir = $(vendorlibdir)/$(sitearch)
32
- vendorlibdir = $(vendordir)/$(ruby_version)
33
- vendordir = $(rubylibprefix)/vendor_ruby
34
- sitearchdir = $(sitelibdir)/$(sitearch)
35
- sitelibdir = $(sitedir)/$(ruby_version)
36
- sitedir = $(rubylibprefix)/site_ruby
37
- rubyarchdir = $(rubylibdir)/$(arch)
38
- rubylibdir = $(rubylibprefix)/$(ruby_version)
39
- sitearchincludedir = $(includedir)/$(sitearch)
40
- archincludedir = $(includedir)/$(arch)
41
- sitearchlibdir = $(libdir)/$(sitearch)
42
- archlibdir = $(libdir)/$(arch)
43
- ridir = $(datarootdir)/$(RI_BASE_NAME)
44
- mandir = $(datarootdir)/man
45
- localedir = $(datarootdir)/locale
46
- libdir = $(exec_prefix)/lib
47
- psdir = $(docdir)
48
- pdfdir = $(docdir)
49
- dvidir = $(docdir)
50
- htmldir = $(docdir)
51
- infodir = $(datarootdir)/info
52
- docdir = $(datarootdir)/doc/$(PACKAGE)
53
- oldincludedir = $(DESTDIR)/usr/include
54
- includedir = $(prefix)/include
55
- localstatedir = $(prefix)/var
56
- sharedstatedir = $(prefix)/com
57
- sysconfdir = $(DESTDIR)/etc
58
- datadir = $(datarootdir)
59
- datarootdir = $(prefix)/share
60
- libexecdir = $(exec_prefix)/libexec
61
- sbindir = $(exec_prefix)/sbin
62
- bindir = $(exec_prefix)/bin
63
- archdir = $(rubyarchdir)
64
-
65
-
66
- CC = gcc
67
- CXX = g++
68
- LIBRUBY = $(LIBRUBY_SO)
69
- LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
70
- LIBRUBYARG_SHARED = -Wl,-rpath,'$${ORIGIN}/../lib' -Wl,-R'$${ORIGIN}/../lib' -l$(RUBY_SO_NAME)
71
- LIBRUBYARG_STATIC = -Wl,-rpath,'$${ORIGIN}/../lib' -Wl,-R'$${ORIGIN}/../lib' -l$(RUBY_SO_NAME)-static
72
- empty =
73
- OUTFLAG = -o $(empty)
74
- COUTFLAG = -o $(empty)
75
-
76
- RUBY_EXTCONF_H =
77
- cflags = $(optflags) $(debugflags) $(warnflags)
78
- cxxflags = $(optflags) $(debugflags) $(warnflags)
79
- optflags = -O3 -fno-fast-math
80
- debugflags = -ggdb3
81
- warnflags = -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -Wdeprecated-declarations -Wno-packed-bitfield-compat
82
- CCDLFLAGS = -fPIC
83
- CFLAGS = $(CCDLFLAGS) $(cflags) -fPIC $(ARCH_FLAG)
84
- INCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir)/ruby/backward -I$(hdrdir) -I$(srcdir)
85
- DEFS =
86
- CPPFLAGS = $(DEFS) $(cppflags)
87
- CXXFLAGS = $(CCDLFLAGS) $(cxxflags) $(ARCH_FLAG)
88
- ldflags = -L. -fstack-protector -rdynamic -Wl,-export-dynamic
89
- dldflags =
90
- ARCH_FLAG =
91
- DLDFLAGS = $(ldflags) $(dldflags) $(ARCH_FLAG)
92
- LDSHARED = $(CC) -shared
93
- LDSHAREDXX = $(CXX) -shared
94
- AR = ar
95
- EXEEXT =
96
-
97
- RUBY_INSTALL_NAME = $(RUBY_BASE_NAME)
98
- RUBY_SO_NAME = ruby
99
- RUBYW_INSTALL_NAME =
100
- RUBY_VERSION_NAME = $(RUBY_BASE_NAME)-$(ruby_version)
101
- RUBYW_BASE_NAME = rubyw
102
- RUBY_BASE_NAME = ruby
103
-
104
- arch = x86_64-linux
105
- sitearch = $(arch)
106
- ruby_version = 2.3.0
107
- ruby = $(bindir)/$(RUBY_BASE_NAME)
108
- RUBY = $(ruby)
109
- ruby_headers = $(hdrdir)/ruby.h $(hdrdir)/ruby/ruby.h $(hdrdir)/ruby/defines.h $(hdrdir)/ruby/missing.h $(hdrdir)/ruby/intern.h $(hdrdir)/ruby/st.h $(hdrdir)/ruby/subst.h $(arch_hdrdir)/ruby/config.h
110
-
111
- RM = rm -f
112
- RM_RF = $(RUBY) -run -e rm -- -rf
113
- RMDIRS = rmdir --ignore-fail-on-non-empty -p
114
- MAKEDIRS = /bin/mkdir -p
115
- INSTALL = /usr/bin/install
116
- INSTALL_PROG = $(INSTALL) -m 0755
117
- INSTALL_DATA = $(INSTALL) -m 644
118
- COPY = cp
119
- TOUCH = exit >
120
-
121
- #### End of system configuration section. ####
122
-
123
- preload =
124
-
125
- libpath = . $(libdir)
126
- LIBPATH = -L. -L$(libdir) -Wl,-R$(libdir)
127
- DEFFILE =
128
-
129
- CLEANFILES = mkmf.log
130
- DISTCLEANFILES =
131
- DISTCLEANDIRS =
132
-
133
- extout =
134
- extout_prefix =
135
- target_prefix = /crypt/isaac
136
- LOCAL_LIBS =
137
- LIBS = $(LIBRUBYARG_SHARED) -lpthread -ldl -lcrypt -lm -lc
138
- ORIG_SRCS = isaac.c rand.c
139
- SRCS = $(ORIG_SRCS)
140
- OBJS = isaac.o rand.o
141
- HDRS = $(srcdir)/rand.h $(srcdir)/standard.h
142
- TARGET = ext
143
- TARGET_NAME = ext
144
- TARGET_ENTRY = Init_$(TARGET_NAME)
145
- DLLIB = $(TARGET).so
146
- EXTSTATIC =
147
- STATIC_LIB =
148
-
149
- TIMESTAMP_DIR = .
150
- BINDIR = $(bindir)
151
- RUBYCOMMONDIR = $(sitedir)$(target_prefix)
152
- RUBYLIBDIR = $(sitelibdir)$(target_prefix)
153
- RUBYARCHDIR = $(sitearchdir)$(target_prefix)
154
- HDRDIR = $(rubyhdrdir)/ruby$(target_prefix)
155
- ARCHHDRDIR = $(rubyhdrdir)/$(arch)/ruby$(target_prefix)
156
-
157
- TARGET_SO = $(DLLIB)
158
- CLEANLIBS = $(TARGET).so
159
- CLEANOBJS = *.o *.bak
160
-
161
- all: $(DLLIB)
162
- static: $(STATIC_LIB) install-rb
163
- .PHONY: all install static install-so install-rb
164
- .PHONY: clean clean-so clean-static clean-rb
165
-
166
- clean-static::
167
- clean-rb-default::
168
- clean-rb::
169
- clean-so::
170
- clean: clean-so clean-static clean-rb-default clean-rb
171
- -$(Q)$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES) .*.time
172
-
173
- distclean-rb-default::
174
- distclean-rb::
175
- distclean-so::
176
- distclean-static::
177
- distclean: clean distclean-so distclean-static distclean-rb-default distclean-rb
178
- -$(Q)$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
179
- -$(Q)$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
180
- -$(Q)$(RMDIRS) $(DISTCLEANDIRS) 2> /dev/null || true
181
-
182
- realclean: distclean
183
- install: install-so install-rb
184
-
185
- install-so: $(DLLIB) $(TIMESTAMP_DIR)/.RUBYARCHDIR.-.crypt.-.isaac.time
186
- $(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR)
187
- clean-static::
188
- -$(Q)$(RM) $(STATIC_LIB)
189
- install-rb: pre-install-rb install-rb-default
190
- install-rb-default: pre-install-rb-default
191
- pre-install-rb: Makefile
192
- pre-install-rb-default: Makefile
193
- pre-install-rb-default:
194
- @$(NULLCMD)
195
- $(TIMESTAMP_DIR)/.RUBYARCHDIR.-.crypt.-.isaac.time:
196
- $(Q) $(MAKEDIRS) $(@D) $(RUBYARCHDIR)
197
- $(Q) $(TOUCH) $@
198
-
199
- site-install: site-install-so site-install-rb
200
- site-install-so: install-so
201
- site-install-rb: install-rb
202
-
203
- .SUFFIXES: .c .m .cc .mm .cxx .cpp .o .S
204
-
205
- .cc.o:
206
- $(ECHO) compiling $(<)
207
- $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
208
-
209
- .cc.S:
210
- $(ECHO) translating $(<)
211
- $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $<
212
-
213
- .mm.o:
214
- $(ECHO) compiling $(<)
215
- $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
216
-
217
- .mm.S:
218
- $(ECHO) translating $(<)
219
- $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $<
220
-
221
- .cxx.o:
222
- $(ECHO) compiling $(<)
223
- $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
224
-
225
- .cxx.S:
226
- $(ECHO) translating $(<)
227
- $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $<
228
-
229
- .cpp.o:
230
- $(ECHO) compiling $(<)
231
- $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
232
-
233
- .cpp.S:
234
- $(ECHO) translating $(<)
235
- $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $<
236
-
237
- .c.o:
238
- $(ECHO) compiling $(<)
239
- $(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $<
240
-
241
- .c.S:
242
- $(ECHO) translating $(<)
243
- $(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -S $<
244
-
245
- .m.o:
246
- $(ECHO) compiling $(<)
247
- $(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $<
248
-
249
- .m.S:
250
- $(ECHO) translating $(<)
251
- $(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -S $<
252
-
253
- $(DLLIB): $(OBJS) Makefile
254
- $(ECHO) linking shared-object crypt/isaac/$(DLLIB)
255
- -$(Q)$(RM) $(@)
256
- $(Q) $(LDSHARED) -o $@ $(OBJS) $(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS)
257
-
258
-
259
-
260
- $(OBJS): $(HDRS) $(ruby_headers)