poly_pseudo 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e8679fa009157ffc7599a9e5f2de720685dde752
4
- data.tar.gz: 157c5b564e95315bb56a18262fe5cc74fd5c177e
3
+ metadata.gz: 793a8c85f4f1ba8dc27efbc62dd9da1128f125e9
4
+ data.tar.gz: bf8bd1a56268675c8c5a75a521ed4c26f0e8c37d
5
5
  SHA512:
6
- metadata.gz: 0e939b0dce6ace496be3240e31f2bec67ce1aa5fb04c8d2d16b9550d7a9b570bd81c830778a5d7afc453b1fb67c7ece63a3c47e27fd9cb9e60ba6aba6d120542
7
- data.tar.gz: 009d42b58a0bbe43cb028dce2ca55c3485836916f3a36c36b2bea19e3a6fbd71c56d02b5f5e3952e25ebb947712ba42173e31151ab8ac24a17df136a8e0dae51
6
+ metadata.gz: 230f00a0e4a3b5ea28cc624bbe5f881504645770bc6a3d7f29270cb1d4e66675d38a856ea666c203d53a98a159864dd8638cfc04b06ed4cfb1c2cdd17a1dc3dc
7
+ data.tar.gz: 7f924a92e4aba19a90f99865df99caaa91d64d7b48a2ce933fc26e306faae0372dfc293f615bfc7bf5086433a64817bd79e4260a1bb19d9b1e6483113f6b7a04
@@ -43,28 +43,13 @@ module PolyPseudo
43
43
  m
44
44
  end
45
45
 
46
- def self.i2osp(x, len = nil)
47
- raise ArgumentError, "integer too large" if len && x >= 256**len
48
-
49
- StringIO.open do |buffer|
50
- while x > 0
51
- b = (x & 0xFF).chr
52
- x >>= 8
53
- buffer << b
54
- end
55
- s = buffer.string
56
- s.force_encoding(Encoding::BINARY) if s.respond_to?(:force_encoding)
57
- s.reverse!
58
- s = len ? s.rjust(len, "\0") : s
59
- end
60
- end
61
-
62
46
  def self.mgf1(z, l)
63
47
  t = ''
64
48
 
65
- (0..(l / 10)).each { |i|
66
- t += Digest::SHA384.digest(z + i2osp(i, 4))
67
- }
49
+ n = (l - 1) / 48 + 1
50
+ n.times do |i|
51
+ t << Digest::SHA384.digest(z + [i].pack('N'))
52
+ end
68
53
 
69
54
  t[0...l]
70
55
  end
@@ -1,3 +1,3 @@
1
1
  module PolyPseudo
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: poly_pseudo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Benoist Claassen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-12-09 00:00:00.000000000 Z
11
+ date: 2018-01-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler