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 +4 -4
- data/.gitignore +1 -0
- data/Gemfile.lock +1 -1
- data/VERSION +1 -1
- data/lib/crypt/cbc.rb +4 -6
- data/lib/crypt/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1503323fa1e5ed3ea4bd0acda221b9b3db37db93
|
4
|
+
data.tar.gz: 73db3b0e52b9c31545a2fbb84e44aaf2da749faa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5a187c56c32f75296cfc10229cd5d2899b74349696e704b81214acaa45c1f09c919c0715ab112a02bad261d83b9ddca4c9c1446dd8e7df76b5dd9431efd380e4
|
7
|
+
data.tar.gz: 0177e6eaff71863016a359560b34f86d2400f85289b6fc32f6a8de3416c33b19ccb89937ca2f92c10a94383db7b268667cdde292e38b705d0c028cf8a953c558
|
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
/pkg
|
data/Gemfile.lock
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.3.0
|
data/lib/crypt/cbc.rb
CHANGED
@@ -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
|
data/lib/crypt/version.rb
CHANGED
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.
|
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-
|
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
|