c7decrypt 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. data/lib/c7decrypt.rb +1 -16
  2. metadata +3 -3
data/lib/c7decrypt.rb CHANGED
@@ -24,17 +24,6 @@ class C7Decrypt
24
24
  /password 7 ([a-zA-Z0-9]+)/
25
25
  ]
26
26
 
27
- def initialize()
28
- @legacy_mode = legacy_mode?
29
- end
30
-
31
- # Detect whether we're running in legacy mode or not
32
- # Ruby 1.8.x uses [0] for ordinal conversion but does not .ord
33
- # Ruby 1.9.x implements .ord but does not support [0] ordinal conversion
34
- def legacy_mode?
35
- return true if RUBY_VERSION.match(/1\.8\.[67]/)
36
- end
37
-
38
27
  # The Decryption Method for Cisco Type-7 Encrypted Strings
39
28
  # @param [String] the Cisco Type-7 Encrypted String
40
29
  # @return [String] the Decrypted String
@@ -57,11 +46,7 @@ class C7Decrypt
57
46
  pt_chars = plain_text.scan(/./)
58
47
  pt_chars.each_with_index do |char,i|
59
48
  tmp = nil
60
- if @legacy_mode
61
- tmp = char[0] ^ VT_TABLE[(i + seed)]
62
- else
63
- tmp = char.ord ^ VT_TABLE[(i + seed)]
64
- end
49
+ tmp = char.unpack('C')[0] ^ VT_TABLE[(i + seed)]
65
50
  etext += ("%02X" % tmp)
66
51
  end
67
52
  return etext
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: c7decrypt
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 29
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 2
10
- version: 0.1.2
9
+ - 3
10
+ version: 0.1.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jonathan Claudius