aion-enigma 0.0.1 → 1.0.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: 123f2307cf57a446b1c46823bd3507bd83ce4784
4
- data.tar.gz: 9cac96a9c1fd6ab3c6a591dd303f450ceb5a055c
3
+ metadata.gz: a0a89e14157738338871b5be211f170f342af292
4
+ data.tar.gz: 0f3d63e630154449524f83e6546829900f8c19fc
5
5
  SHA512:
6
- metadata.gz: 634e1f259feed493be4703935b9409461e6bc1dbb52c201551b09dcc81ca5484a73ee1d5c01020313b7fb45a8673e3d1f52e3c44af5bd9d8ee59cbcbe32050b8
7
- data.tar.gz: 9fdcc2e6e9951444e2d4293fbef8180f1f8233fe4bfbf3f91cabbf862a53aac89faa85c5b3fb9b8d818f8942376eb6a7e6f0a3c0ca5317e8874bfa8118ba04bc
6
+ metadata.gz: 7b5abb7b2e2f31d6eed0841b803c36b6bbd8daee3fe3fe3d7261ad5dccc90c9183aa2b694930c7f869572192b8f8ff6c3ecc79fff2593acd067209a4c13cd8e5
7
+ data.tar.gz: 48970b3f4111afa321fbbf405bb4b46bb55bfc32f5727ca8f8b6bcab936992b38f85986beec3d5807b9c4e59306448a896bf3b94a2892fa4cd07b600dcc87a9e
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
- Enigma
1
+ AionEnigma
2
2
  ======
3
3
 
4
- Enigma is a small utility for encrypting/decrypting a string based on a shared secret using AES-265-CBC.
4
+ AionEnigma is a small utility for encrypting/decrypting a string based on a shared secret using AES-265-CBC.
5
5
 
6
6
  Install
7
7
  -------
@@ -18,9 +18,9 @@ Usage
18
18
  secret_message = 'this is a secret message'
19
19
  shared_secret = 'some shared secret'
20
20
 
21
- enigma = Enigma.new(shared_secret)
21
+ enigma = AionEnigma.new(shared_secret)
22
22
  encrypted_message = enigma.encrypt(secret_message)
23
- # encrypted_message ≈> 'Gn3AZKG9aqv+ALTfI9ZbuQ==|7hI5iN1Jdm73zQB1nTBngX07SaX60nuirWQRtNygIgE='
23
+ # encrypted_message ≈> 'ivBsGDsQjG6ScC5wq7Q-2w~XgFz1c4mdDR_MhI0VkpvNMcINDHCrAXEb1RlzwXpuNU'
24
24
 
25
25
  message = enigma.decrypt(encrypted_message)
26
26
  # message => 'this is a secret message'
@@ -1 +1 @@
1
- require 'enigma'
1
+ require 'aion_enigma'
@@ -1,7 +1,7 @@
1
1
  require 'openssl'
2
2
  require 'base64'
3
3
 
4
- class Enigma
4
+ class AionEnigma
5
5
 
6
6
  class EncryptError < StandardError; end
7
7
  class DecryptError < StandardError; end
@@ -12,7 +12,7 @@ class Enigma
12
12
  unless secret.is_a? String
13
13
  fail ArgumentError, 'secret must be a string'
14
14
  end
15
- @key = Digest::SHA1.hexdigest(secret)
15
+ @key = Digest::SHA2.digest(secret)
16
16
  end
17
17
 
18
18
  # Encrypts a string.
@@ -89,7 +89,7 @@ class Enigma
89
89
  # @param encrypted the encrypted bytes
90
90
  # @return String with serialized iv and encrypted parameters
91
91
  def pack(iv, encrypted)
92
- [iv, encrypted].map { |x| Base64.encode64(x).strip }.join('|')
92
+ [iv, encrypted].map { |x| Base64.urlsafe_encode64(x).gsub('=','') }.join('~')
93
93
  end
94
94
 
95
95
  # Unpacking the encrypted_message into an array of iv and encrypted data.
@@ -103,7 +103,7 @@ class Enigma
103
103
  # @param encrypted_message as outputted by Enigma#pack
104
104
  # @return Array containing iv bytes and encrypted bytes
105
105
  def unpack(encrypted_message)
106
- encrypted_message.split('|').map { |m| Base64.decode64(m) }
106
+ encrypted_message.split('~').map { |m| Base64.urlsafe_decode64(m) }
107
107
  end
108
108
 
109
109
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aion-enigma
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Andersen
@@ -50,8 +50,8 @@ extra_rdoc_files: []
50
50
  files:
51
51
  - README.md
52
52
  - lib/aion-enigma.rb
53
- - lib/enigma.rb
54
- homepage: https://github.com/aion-dk/enigma
53
+ - lib/aion_enigma.rb
54
+ homepage: https://github.com/aion-dk/aion-enigma
55
55
  licenses:
56
56
  - MIT
57
57
  metadata: {}
@@ -71,7 +71,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
71
71
  version: '0'
72
72
  requirements: []
73
73
  rubyforge_project:
74
- rubygems_version: 2.4.5.1
74
+ rubygems_version: 2.6.13
75
75
  signing_key:
76
76
  specification_version: 4
77
77
  summary: Encryption utility based on AES