Hasher-Generator 0.0.1
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 +7 -0
- data/lib/Hasher-Generator.rb +70 -0
- metadata +44 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 3ffb851b900e6372387694a561cda5812810ec4d
|
4
|
+
data.tar.gz: fc3d48866e22dfb24fd6c17cef6ef9b57d1b0cec
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: bf4615e7ceadd536d6c56d65b6ef694afcfce6220b7ce92dd73e3b98ec01060069733f1d2f269f60b05f44314c327c5a6991a0878b58a77380b4641cb1084ba0
|
7
|
+
data.tar.gz: c91c758218be14a12fc114f8700939da81d9a7f1948250c66cd250eaea78c1e353735d1a1eacab420af68eece5f56ce12b72600165af4a95d1d59511f73a58c8
|
@@ -0,0 +1,70 @@
|
|
1
|
+
require 'digest'
|
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")
|
8
|
+
#
|
9
|
+
# The same string and file methods can be called with other algorithms such as sha256_string and sha256_file and
|
10
|
+
# sha512_string and sha512_file
|
11
|
+
#
|
12
|
+
# Have fun!
|
13
|
+
class Hasher
|
14
|
+
|
15
|
+
# MD5 METHODS
|
16
|
+
def md5_string(string)
|
17
|
+
md5 = Digest::MD5.new
|
18
|
+
return md5.hexdigest string
|
19
|
+
end
|
20
|
+
|
21
|
+
def md5_file(file_path)
|
22
|
+
if file_path.nil? then
|
23
|
+
puts '[!]Invalid file or path!'
|
24
|
+
exit 1
|
25
|
+
else
|
26
|
+
md5 = Digest::MD5.file file_path
|
27
|
+
return md5
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
|
32
|
+
# SHA256 METHODS
|
33
|
+
|
34
|
+
def sha256_string(string)
|
35
|
+
sha256 = Digest::SHA256.new
|
36
|
+
return sha256.hexdigest string
|
37
|
+
end
|
38
|
+
|
39
|
+
def sha256_file(file_path)
|
40
|
+
if file_path.nil? then
|
41
|
+
puts '[!]Invalid file or path!'
|
42
|
+
exit 1
|
43
|
+
else
|
44
|
+
sha256 = Digest::SHA256.file file_path
|
45
|
+
return sha256
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
# SHA512 METHODS
|
54
|
+
|
55
|
+
def sha512_string(string)
|
56
|
+
sha512 = Digest::SHA512.new
|
57
|
+
return sha512.hexdigest string
|
58
|
+
end
|
59
|
+
|
60
|
+
|
61
|
+
def sha512_file(file_path)
|
62
|
+
if file_path.nil? then
|
63
|
+
puts '[!]Invalid file or path!'
|
64
|
+
exit 1
|
65
|
+
else
|
66
|
+
sha512 = Digest::SHA512.file file_path
|
67
|
+
return sha512
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
metadata
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: Hasher-Generator
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- GR33N-H4Z3
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-10-11 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: quick and easy Hasher for md5 sha256 and sha512
|
14
|
+
email:
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- lib/Hasher-Generator.rb
|
20
|
+
homepage: http://rubygems.orb/gems/greenhaze-hasher
|
21
|
+
licenses:
|
22
|
+
- GPL-2.0
|
23
|
+
metadata: {}
|
24
|
+
post_install_message:
|
25
|
+
rdoc_options: []
|
26
|
+
require_paths:
|
27
|
+
- lib
|
28
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
34
|
+
requirements:
|
35
|
+
- - ">="
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
requirements: []
|
39
|
+
rubyforge_project:
|
40
|
+
rubygems_version: 2.6.14
|
41
|
+
signing_key:
|
42
|
+
specification_version: 4
|
43
|
+
summary: MD5 , SHA256 , SHA512 hasher using Digest.
|
44
|
+
test_files: []
|