ctf-party 1.3.4 → 1.3.5

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
  SHA256:
3
- metadata.gz: 588a5007de92c7e4c3fe7654f755eb9d1f9c81a738739455b3f9b89eb87ea9fa
4
- data.tar.gz: 85bad8baf276cfa5315dc59f1804b4b21e21f46c8061d1d1bb2e5068e82167ad
3
+ metadata.gz: f09406956f91fdbe561c73f343efc68e28ad20c774370053e88472ebb1bb5098
4
+ data.tar.gz: 8bf8dfddfdbb4780578216b022d4815778f6f79d489506a2dba9fa0355bc8f90
5
5
  SHA512:
6
- metadata.gz: b0894030c2104ef8cd1421c8ec579e36760af961ad8782ff9ae9cab279a2ebd62dab7e19560d68b69bfabb616f5f84020735546d1470716cea0cf1e6ba6417ff
7
- data.tar.gz: 923114873849d37ef0a3b1f5bd4a087e1a385c95e28dcd87761ecc247f51eda936ee058a977c6b25d7c35592133e40a602e89097cea68f8f36cdd61f2759d42d
6
+ metadata.gz: 40adf3307a9e8b99ccda9af3d1ab063413433998455cf92c292eb9b6e8d3deb754280673e796d7d980e22c87c222b7eb07c1fd7a6434d4597c186857ea973937
7
+ data.tar.gz: e3d1bbf14cf1dd05112833a7fa8096acaf0ee6065a266990fa56a71c30415f504a83255c8ae835188dfbd25593e37b983d06b7c137ed5e3d0598ebd3dcc83edd
data/lib/ctf_party.rb CHANGED
@@ -10,3 +10,4 @@ require 'ctf_party/case'
10
10
  require 'ctf_party/cgi'
11
11
  require 'ctf_party/binary'
12
12
  require 'ctf_party/leet'
13
+ require 'ctf_party/dec'
@@ -0,0 +1,49 @@
1
+ # frozen_string_literal: true
2
+
3
+ class String
4
+ # Encode a string into decimal (string to hexadecimal then hexadecimal to decimal)
5
+ # @return [String] the decimal encoded string
6
+ # @example
7
+ # 'noraj'.to_dec # => "474316169578"
8
+ def to_dec
9
+ str2hex.hex2dec
10
+ end
11
+
12
+ # Encode a string into decimal in place as described for {String#to_dec}.
13
+ def to_dec!
14
+ replace(to_dec)
15
+ end
16
+
17
+ # Decode a decimal string (decimal to hexadecimal then hexadecimal to string)
18
+ # @return [String] the decimal decoded string
19
+ # @example
20
+ # '1834615104613964215417'.from_dec # => "ctf-party"
21
+ def from_dec
22
+ dec2hex.hex2str
23
+ end
24
+
25
+ # Decode a decimal string in place as described for {String#from_dec}.
26
+ def from_dec!
27
+ replace(from_dec)
28
+ end
29
+
30
+ # Alias for {String#to_dec}.
31
+ def str2dec
32
+ to_dec
33
+ end
34
+
35
+ # Alias for {String#to_dec!}.
36
+ def str2dec!
37
+ replace(str2dec)
38
+ end
39
+
40
+ # Alias for {String#from_dec}.
41
+ def dec2str
42
+ from_dec
43
+ end
44
+
45
+ # Alias for {String#from_dec!}.
46
+ def dec2str!
47
+ replace(dec2str)
48
+ end
49
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Version
4
- VERSION = '1.3.4'
4
+ VERSION = '1.3.5'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ctf-party
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.4
4
+ version: 1.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexandre ZANNI
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-17 00:00:00.000000000 Z
11
+ date: 2021-04-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '3.0'
47
+ version: '4.0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '3.0'
54
+ version: '4.0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: minitest
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -152,6 +152,7 @@ files:
152
152
  - lib/ctf_party/binary.rb
153
153
  - lib/ctf_party/case.rb
154
154
  - lib/ctf_party/cgi.rb
155
+ - lib/ctf_party/dec.rb
155
156
  - lib/ctf_party/digest.rb
156
157
  - lib/ctf_party/flag.rb
157
158
  - lib/ctf_party/hex.rb