haiti-hash 1.2.3 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/lib/haiti/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Version
4
- VERSION = '1.2.3'
4
+ VERSION = '1.4.0'
5
5
  end
data/lib/haiti.rb CHANGED
@@ -30,6 +30,25 @@ class HashIdentifier
30
30
  sort_commons
31
31
  end
32
32
 
33
+ class << self
34
+ # Find hash samples for a given hash type (by name or hashcat/john the ripper reference)
35
+ # @param input [String|Integer] hash type name, hashcat reference, john the ripper reference
36
+ # @return [Array<String>] a list of samples
37
+ # @example
38
+ # HashIdentifier.samples('crc32')
39
+ # # => ["c762de4a:00000000", "$crc32$00000000.fa455f6b", "$crc32$4ff4f23f.ce6eb863", "5e23d60f:00000000"]
40
+ def samples(input)
41
+ samples = []
42
+ PROTOTYPES.each do |prototype|
43
+ prototype['modes'].each do |mode|
44
+ samples << Chf.new(mode).samples if [mode['name'], mode['hashcat'].to_s, mode['john']].include?(input)
45
+ end
46
+ end
47
+ samples.delete(nil)
48
+ samples.flatten.uniq
49
+ end
50
+ end
51
+
33
52
  private
34
53
 
35
54
  # Check which hash types are matching the provided hash
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: haiti-hash
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.3
4
+ version: 1.4.0
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-12-15 00:00:00.000000000 Z
11
+ date: 2022-09-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: docopt
@@ -38,7 +38,7 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '2.2'
41
- description: A CLI tool to identify the hash type of a given hash.
41
+ description: Hash type identifier (CLI & lib).
42
42
  email: alexandre.zanni@engineer.com
43
43
  executables:
44
44
  - haiti
@@ -76,14 +76,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
76
76
  version: 2.5.0
77
77
  - - "<"
78
78
  - !ruby/object:Gem::Version
79
- version: '3.1'
79
+ version: '3.2'
80
80
  required_rubygems_version: !ruby/object:Gem::Requirement
81
81
  requirements:
82
82
  - - ">="
83
83
  - !ruby/object:Gem::Version
84
84
  version: '0'
85
85
  requirements: []
86
- rubygems_version: 3.2.15
86
+ rubygems_version: 3.3.7
87
87
  signing_key:
88
88
  specification_version: 4
89
89
  summary: HAsh IdenTifIer