crypt19-rb 1.2.2 → 1.3.0

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: 4a9f3b81613ed54c16adf3a776b71a2eea6f0aac
4
- data.tar.gz: cb6d1a9558c0e5e92852e226348a59d97b8af978
3
+ metadata.gz: 1503323fa1e5ed3ea4bd0acda221b9b3db37db93
4
+ data.tar.gz: 73db3b0e52b9c31545a2fbb84e44aaf2da749faa
5
5
  SHA512:
6
- metadata.gz: 28e0676f55f90ee1f2290ef59b9b624f565340a8970f2f9921feea0168d6e337ab228280f77e84c846d85c5bcfc7fcf262a63dc7bf5fc919017bd33b1f1ed3be
7
- data.tar.gz: d822bd479b2a300b53382b48427d6a8105462168a1397c1fd9198deb4663f9912c82989eeffa82c28661096b06daee76c9a95ddc52a3638ef18049f8e5c81c94
6
+ metadata.gz: 5a187c56c32f75296cfc10229cd5d2899b74349696e704b81214acaa45c1f09c919c0715ab112a02bad261d83b9ddca4c9c1446dd8e7df76b5dd9431efd380e4
7
+ data.tar.gz: 0177e6eaff71863016a359560b34f86d2400f85289b6fc32f6a8de3416c33b19ccb89937ca2f92c10a94383db7b268667cdde292e38b705d0c028cf8a953c558
@@ -0,0 +1 @@
1
+ /pkg
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- crypt19-rb (1.2.2)
4
+ crypt19-rb (1.3.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.2.2
1
+ 1.3.0
@@ -13,7 +13,6 @@ module Crypt
13
13
 
14
14
 
15
15
  def generate_initialization_vector(words)
16
- srand(Time.now.to_i)
17
16
  vector = ""
18
17
  words.times {
19
18
  vector << [rand(ULONG)].pack('N')
@@ -22,10 +21,9 @@ module Crypt
22
21
  end
23
22
 
24
23
 
25
- def encrypt_stream(plain_stream, crypt_stream)
24
+ def encrypt_stream(plain_stream, crypt_stream, init_vector = nil)
26
25
  # Cypher-block-chain mode
27
-
28
- init_vector = generate_initialization_vector(block_size() / 4)
26
+ init_vector ||= generate_initialization_vector(block_size() / 4)
29
27
  chain = encrypt_block(init_vector)
30
28
  crypt_stream.write(chain)
31
29
 
@@ -99,10 +97,10 @@ module Crypt
99
97
  end
100
98
 
101
99
 
102
- def encrypt_string(plain_text)
100
+ def encrypt_string(plain_text, init_vector = nil)
103
101
  plain_stream = StringIO.new(plain_text)
104
102
  crypt_stream = StringIO.new('')
105
- encrypt_stream(plain_stream, crypt_stream)
103
+ encrypt_stream(plain_stream, crypt_stream, init_vector)
106
104
  crypt_text = crypt_stream.string
107
105
  return(crypt_text)
108
106
  end
@@ -1,4 +1,4 @@
1
1
  # coding: ASCII
2
2
  module Crypt
3
- VERSION = "1.2.2"
3
+ VERSION = "1.3.0"
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: crypt19-rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.2
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Rudenberg
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-07-30 00:00:00.000000000 Z
13
+ date: 2013-07-31 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rake
@@ -35,6 +35,7 @@ executables: []
35
35
  extensions: []
36
36
  extra_rdoc_files: []
37
37
  files:
38
+ - .gitignore
38
39
  - .travis.yml
39
40
  - Gemfile
40
41
  - Gemfile.lock