event-shipper 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/bin/producer CHANGED
@@ -8,7 +8,7 @@ n = Integer(ARGV.first || 1)
8
8
  sleep_seconds = (1 / Float(n))
9
9
 
10
10
  File.open('test.log', 'a+') do |file|
11
- file.sync = true
11
+ # file.sync = true
12
12
 
13
13
  loop do
14
14
  file.puts "A message (#{Time.now})"
@@ -31,20 +31,21 @@ module EventShipper::Transport
31
31
  def enc str
32
32
  cipher = OpenSSL::Cipher::AES256.new(:CBC)
33
33
  cipher.encrypt
34
- # cipher.random_iv
34
+ iv = cipher.random_iv
35
35
  cipher.key = @key
36
36
 
37
37
  ciphertext = cipher.update(str) + cipher.final
38
38
 
39
- "Salted__#{@salt}#{ciphertext}" #OpenSSL compatible
39
+ "#@salt#{iv}#{ciphertext}"
40
40
  end
41
41
  def dec str
42
- salt = str[8..15]
43
- str = str[16..-1]
44
-
42
+ salt = str[0,8]
43
+ iv = str[8,16]
44
+ str = str[24..-1]
45
+
45
46
  cipher = OpenSSL::Cipher::AES256.new(:CBC)
46
47
  cipher.decrypt
47
- # cipher.random_iv
48
+ cipher.iv = iv
48
49
  cipher.key = generate_key(@password, salt)
49
50
 
50
51
  cipher.update(str) + cipher.final
@@ -88,6 +89,7 @@ if $0 == __FILE__
88
89
 
89
90
  dec = EventShipper::Transport::Encryption.new 'password'
90
91
  puts dec.dec(str)
92
+ exit
91
93
 
92
94
  require 'benchmark'
93
95
  puts "Doing it a 1000 times"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: event-shipper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: