hashsum 2.1.3 → 2.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/hashsum +1 -1
- data/lib/hashsum.rb +15 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ca579c54a5f33307119774b1e1bb2ba6a2d251ef
|
4
|
+
data.tar.gz: 2e8cb57ebd02b5c9c63abaae579d435f3c707a97
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b66ea08ad036ca20bb2c89ae5ba2231eb7f610b3be2838bb7adc365a393c6f991a9f7fc35def4b77e1fcb32f0a30752dbdb7d2297e262b76419d4e9b8cfd7e98
|
7
|
+
data.tar.gz: 5638ab7ddba7e9904f6ffa87f9752d4ec8539a26cb0e84d0924606214d25ce574efbf9f4e7598859a6f0fd56ea3fcb25b197dccf5c1a58afc698f818226566bd
|
data/bin/hashsum
CHANGED
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
|