haiti-hash 1.3.0 → 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.3.0'
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.3.0
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: 2022-01-31 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
@@ -83,7 +83,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
83
83
  - !ruby/object:Gem::Version
84
84
  version: '0'
85
85
  requirements: []
86
- rubygems_version: 3.3.3
86
+ rubygems_version: 3.3.7
87
87
  signing_key:
88
88
  specification_version: 4
89
89
  summary: HAsh IdenTifIer