hashsum 2.1.3 → 2.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/hashsum +1 -1
  3. data/lib/hashsum.rb +15 -0
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d24b82348b01eee6f0a7a64d8b8f463190fc13bd
4
- data.tar.gz: 4b88c384fdb806da7460bc5db65c683c38343195
3
+ metadata.gz: ca579c54a5f33307119774b1e1bb2ba6a2d251ef
4
+ data.tar.gz: 2e8cb57ebd02b5c9c63abaae579d435f3c707a97
5
5
  SHA512:
6
- metadata.gz: 70de88e6cbcbaa23272b088e0e10839c484c068b028637a490a7b77e54ca165d7629b0c04a3dbbfc35ef0debab9117139f6715b745a7e465544ee65b2b428d0a
7
- data.tar.gz: dbf6a48866b2da1c4ec6f05ec4bf7f1f9ce24af29e033369e7ce298efb582a8bc2504e2323ff90ea286195ff1972374bdc09bedb714eda045183c08c375080e4
6
+ metadata.gz: b66ea08ad036ca20bb2c89ae5ba2231eb7f610b3be2838bb7adc365a393c6f991a9f7fc35def4b77e1fcb32f0a30752dbdb7d2297e262b76419d4e9b8cfd7e98
7
+ data.tar.gz: 5638ab7ddba7e9904f6ffa87f9752d4ec8539a26cb0e84d0924606214d25ce574efbf9f4e7598859a6f0fd56ea3fcb25b197dccf5c1a58afc698f818226566bd
data/bin/hashsum CHANGED
@@ -15,7 +15,7 @@ HELP = <<-EOS
15
15
  hashsum -a md5 foo
16
16
  EOS
17
17
 
18
- VERSION = '2.1.3'
18
+ VERSION = '2.1.4'
19
19
 
20
20
  case ARGV.first
21
21
  when '-h', '--help'
data/lib/hashsum.rb CHANGED
@@ -1,3 +1,4 @@
1
+ # @author Francesco Russo
1
2
  class String
2
3
  # Algorithms
3
4
  HASH = {
@@ -8,24 +9,38 @@ class String
8
9
  sha384: Digest::SHA384,
9
10
  sha512: Digest::SHA512
10
11
  }
12
+ # Encrypt a String with an algorithm and a salt if you want more security
13
+ # hashsum(hash, salt = "")
11
14
  def hashsum(hash, salt = "")
12
15
  HASH[hash].hexdigest(salt+self)
13
16
  end
17
+ # Encrypt a String with MD5 and a salt if you want more security
18
+ # to_md5(salt = "")
14
19
  def to_md5(salt = "")
15
20
  hashsum(:md5, salt)
16
21
  end
22
+ # Encrypt a String with SHA1 and a salt if you want more security
23
+ # to_sha1(salt = "")
17
24
  def to_sha1(salt = "")
18
25
  hashsum(:sha1, salt)
19
26
  end
27
+ # Encrypt a String with SHA2 and a salt if you want more security
28
+ # to_sha2(salt = "")
20
29
  def to_sha2(salt = "")
21
30
  hashsum(:sha2, salt)
22
31
  end
32
+ # Encrypt a String with SHA256 and a salt if you want more security
33
+ # to_sha256(salt = "")
23
34
  def to_sha256(salt = "")
24
35
  hashsum(:sha256, salt)
25
36
  end
37
+ # Encrypt a String with SHA384 and a salt if you want more security
38
+ # to_384(salt = "")
26
39
  def to_sha384(salt = "")
27
40
  hashsum(:sha384, salt)
28
41
  end
42
+ # Encrypt a String with SHA512 and a salt if you want more security
43
+ # to_sha512(salt = "")
29
44
  def to_sha512(salt = "")
30
45
  hashsum(:sha512, salt)
31
46
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hashsum
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.3
4
+ version: 2.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Francesco Russo