Hasher-Generator 0.0.1 → 0.0.2
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.
- checksums.yaml +4 -4
- data/lib/Hasher-Generator.rb +17 -6
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d39fe34b5d4965b801743fd0e31ba5f6c86c098f
|
4
|
+
data.tar.gz: 9493d0cacf5a78400bc20ce34f08e2b7679e1172
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a5b2eaad5627e9bfac7aa5eebbd5048bcc16b3b7101448583f74f13c21473f390b472d63af4cf9d1e0e42b318e55fa2ad209d85a2f8b3c3d3e933a8656c96c46
|
7
|
+
data.tar.gz: f1ede0ee31be4dcde7e9ac90804765e82a06ce859b9f2079d424e7d9b3678b4fb9cf56b2565bada77df558a90cf31fe88e00940c8cf5ae8d1a792cb68a433cde
|
data/lib/Hasher-Generator.rb
CHANGED
@@ -1,20 +1,25 @@
|
|
1
1
|
require 'digest'
|
2
2
|
|
3
|
-
# HASHER CLASS FOR MD5 AND SHA256 HASHES
|
4
|
-
#
|
5
|
-
# Example:
|
6
|
-
# hasher = Hasher.md5_string("Example string here")
|
7
|
-
# file_hash = Hasher.md5_file("/home/username/Desktop/testfile.txt")
|
3
|
+
# HASHER CLASS FOR MD5 AND SHA256/512 HASHES
|
8
4
|
#
|
5
|
+
# Examples:
|
6
|
+
# hasher = Hasher.new
|
7
|
+
# puts hasher.md5_string("Example string here")
|
8
|
+
#
|
9
|
+
# file_hash = Hasher.new
|
10
|
+
# puts file_hash.md5_file("/home/username/Desktop/testfile.txt")
|
11
|
+
#
|
9
12
|
# The same string and file methods can be called with other algorithms such as sha256_string and sha256_file and
|
10
13
|
# sha512_string and sha512_file
|
11
14
|
#
|
12
|
-
# Have fun!
|
15
|
+
# Have fun! and sorry for Versions 0.0.0-0.0.1 bad examples , they didnt work.
|
16
|
+
# These examples are up to date and work as expected - GR33N-H4Z3.
|
13
17
|
class Hasher
|
14
18
|
|
15
19
|
# MD5 METHODS
|
16
20
|
def md5_string(string)
|
17
21
|
md5 = Digest::MD5.new
|
22
|
+
# returns md5 hash of the string
|
18
23
|
return md5.hexdigest string
|
19
24
|
end
|
20
25
|
|
@@ -24,6 +29,7 @@ class Hasher
|
|
24
29
|
exit 1
|
25
30
|
else
|
26
31
|
md5 = Digest::MD5.file file_path
|
32
|
+
# returns md5 hash of the file
|
27
33
|
return md5
|
28
34
|
end
|
29
35
|
end
|
@@ -33,6 +39,8 @@ class Hasher
|
|
33
39
|
|
34
40
|
def sha256_string(string)
|
35
41
|
sha256 = Digest::SHA256.new
|
42
|
+
|
43
|
+
# returns SHA256 hash of string
|
36
44
|
return sha256.hexdigest string
|
37
45
|
end
|
38
46
|
|
@@ -42,6 +50,7 @@ class Hasher
|
|
42
50
|
exit 1
|
43
51
|
else
|
44
52
|
sha256 = Digest::SHA256.file file_path
|
53
|
+
# returns SHA256 hash of file
|
45
54
|
return sha256
|
46
55
|
end
|
47
56
|
end
|
@@ -54,6 +63,7 @@ class Hasher
|
|
54
63
|
|
55
64
|
def sha512_string(string)
|
56
65
|
sha512 = Digest::SHA512.new
|
66
|
+
# returns SHA512 hash of string
|
57
67
|
return sha512.hexdigest string
|
58
68
|
end
|
59
69
|
|
@@ -64,6 +74,7 @@ class Hasher
|
|
64
74
|
exit 1
|
65
75
|
else
|
66
76
|
sha512 = Digest::SHA512.file file_path
|
77
|
+
# returns SHA512 hash of file
|
67
78
|
return sha512
|
68
79
|
end
|
69
80
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: Hasher-Generator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GR33N-H4Z3
|
@@ -10,7 +10,8 @@ bindir: bin
|
|
10
10
|
cert_chain: []
|
11
11
|
date: 2017-10-11 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description: quick and easy Hasher for md5 sha256 and sha512
|
13
|
+
description: A quick and easy Hasher class for md5 sha256 and sha512. Version 0.0.2
|
14
|
+
should have up to date examples. My apologies for the older versions.
|
14
15
|
email:
|
15
16
|
executables: []
|
16
17
|
extensions: []
|