├── .gitignore ├── Gemfile ├── LICENSE ├── README.md ├── Rakefile ├── bin └── hashdata ├── hashdata.gemspec ├── lib └── hashdata.rb ├── screenshot.png └── test └── hashdata_spec.rb /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | *.gem 3 | *.rbc 4 | .bundle 5 | .config 6 | *.lock 7 | coverage 8 | InstalledFiles 9 | lib/bundler/man 10 | pkg 11 | rdoc 12 | spec/reports 13 | test/tmp 14 | test/version_tmp 15 | tmp 16 | 17 | # YARD artifacts 18 | .yardoc 19 | _yardoc 20 | doc/ 21 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | gemspec 4 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013 Sam Brown 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Gem Version](https://badge.fury.io/rb/hashdata.png)](http://badge.fury.io/rb/hashdata) 2 | # HashData 3 | A REPL for hashing, encoding, and encryption identification. The listings aren't complete and will generally give numerous possibilities for each input due to the nature of a lot of functions having output in a similar format. 4 | 5 | ![Screenshot](screenshot.png?raw=true) 6 | 7 | ## Install 8 | ```bash 9 | $ gem install hashdata 10 | ``` 11 | 12 | ## Usage 13 | #### Command Line 14 | When installed, run `hashdata` and paste in hashes when prompted. 15 | 16 | #### Library 17 | 18 | Example Script: 19 | ```ruby 20 | require 'hashdata' 21 | hash = HashData.new 22 | puts(hash.check_type("1111111111111",'DES')) 23 | ``` 24 | Should output true. The library only matches the start of your second input, this means that you can check something is an 25 | MD5 hash without having to worry about wether it is from Joomla or Unix for example. 26 | 27 | ## Supports 28 | - Adler32 29 | - Blowfish(Eggdrop), Blowfish(OpenBSD) 30 | - CRC-16, CRC-16-CCITT 31 | - CRC-32, CRC-32B 32 | - CRC-96(ZIP) 33 | - Domain Cached Credentials, Domain Cached Credentials 2 34 | - DES(Unix), DES(Oracle) 35 | - FCS-16, FCS-32 36 | - FNV-132, FNV-164 37 | - GOST R 34.11-94 38 | - GHash-32-3, GHash-32-5 39 | - Haval-128, Haval-160, Haval-192, Haval-224, Haval-256 40 | - Joaat 41 | - Lineage II C4 42 | - LM 43 | - Lotus Domino 44 | - MD2, MD4, MD5 45 | - MD5(Joomla), MD5(osCommerce), MD5(PalshopCMS) 46 | - MD5(APR), MD5(Cisco PIX), MD5(Unix) 47 | - MD5(IP.Board), MD5(MyBB), MD5(phpBB3), MD5(WordPress) 48 | - MySQL3.x, MySQL4.x, MySQL5.x 49 | - MSSQL(2000), MSSQL(2005), MSSQL(2008) 50 | - NTLM 51 | - RAdmin v2.x 52 | - RIPEMD-128, RIPEMD-160, RIPEMD-256, RIPEMD-320 53 | - SAM(LM_Hash:NT_Hash) 54 | - SHA-1, SHA-1(Django), SHA-1(MaNGOS), SHA-1(MaNGOS2) 55 | - SHA-224 56 | - SHA-256, SHA-256(Django), SHA-256(Unix) 57 | - SHA3-224, SHA3-256, SHA3-384, SHA3-512 58 | - SHA-384, SHA-384(Django) 59 | - SHA-512, SHA-512(Drupal), SHA-512(Unix) 60 | - SSHA-1 61 | - Skein-256, Skein-256(128), Skein-256(160), Skein-256(224) 62 | - Skein-512, Skein-512(128), Skein-512(160), Skein-512(224), Skein-512(256), Skein-512(384) 63 | - Skein-1024, Skein-1024(384), Skein-1024(512) 64 | - Snefru-128, Snefru-256 65 | - Tiger-128, Tiger-160, Tiger-192 66 | - VNC 67 | - Whirlpool 68 | - XOR-32 69 | 70 | ## Development 71 | Development is on going and new hashes are added sporadically and when requested and errors are fixed whenever reported. 72 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | require 'bundler/gem_tasks' -------------------------------------------------------------------------------- /bin/hashdata: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # encoding: utf-8 3 | 4 | $LOAD_PATH.unshift(File.dirname(File.realpath(__FILE__)) + '/../lib') 5 | require 'hashdata' 6 | 7 | puts 'Use Ctrl+C to exit program.' 8 | hash = HashData.new 9 | 10 | loop do 11 | print('Enter your Hash: ') 12 | trap('SIGINT') do 13 | puts("\n") 14 | exit 15 | end 16 | out = hash.check(gets.chomp) 17 | out.empty? ? puts("\e[31m#{'No hash matches found!'}\e[0m") : puts("\e[32m#{out}\e[0m") 18 | puts 19 | end 20 | -------------------------------------------------------------------------------- /hashdata.gemspec: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | lib = File.expand_path('../lib', __FILE__) 3 | $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) 4 | 5 | Gem::Specification.new do |spec| 6 | spec.name = 'hashdata' 7 | spec.version = '0.0.3' 8 | spec.authors = ['Sam Brown'] 9 | spec.email = ['samdanielbrown@gmail.com'] 10 | spec.summary = %q{A command line Hash Identifying tool.} 11 | spec.homepage = 'https://github.com/sam-b/HashData' 12 | spec.license = 'MIT' 13 | spec.description = 'A command line hash identifying tool and checking library.' 14 | spec.files = `git ls-files -z`.split("\x0") 15 | spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } 16 | spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) 17 | spec.require_paths = ['lib'] 18 | 19 | spec.add_development_dependency 'bundler', '~> 1.5' 20 | spec.add_development_dependency 'rake', '~> 10.1' 21 | spec.add_development_dependency 'rspec', '~> 3.3.0' 22 | end 23 | -------------------------------------------------------------------------------- /lib/hashdata.rb: -------------------------------------------------------------------------------- 1 | class HashData 2 | PATTERNS = [ 3 | [/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/,'Base64'], 4 | [/^[a-f0-9]{4}$/, 'CRC-16, CRC-16-CCITT, FCS-16'], 5 | [/^[a-f0-9]{8}$/, 'Adler32, CRC-32, CRC-32B, FCS-32, GHash-32-3, GHash-32-5, XOR-32, FNV-132, Joaat'], 6 | [/^\+[a-z0-9\/\.]{12}$/, 'Blowfish(Eggdrop)'], 7 | [/^.{0,2}[a-zA-Z0-9\/\.]{11}$/, 'DES(Unix)'], 8 | [/^[a-f0-9]{16}$/, 'MySQL3.x, LM, DES(Oracle), VNC, FNV-164'], 9 | [/^[a-z0-9\/\.]{16}$/, 'MD5(Cisco PIX)'], 10 | [/^\$1\$.{0,8}\$[a-z0-9\/\.]{22}$/, 'MD5(Unix)'], 11 | [/^\$apr1\$.{0,8}\$[a-z0-9\/\.]{22}$/, 'MD5(APR)'], 12 | [/^[a-f0-9]{24}$/, 'CRC-96(ZIP)'], 13 | [/^\$H\$[a-z0-9\/\.]{31}$/, 'MD5(phpBB3)'], 14 | [/^\$P\$[a-z0-9\/\.]{31}$/, 'MD5(Wordpress)'], 15 | [/^[0-9a-f]{32}$/, 'MD5, NTLM, Domain Cached Credentials, Domain Cached Credentials 2, RAdminv2.x, MD4, MD2,RIPEMD-128, Haval-128, Tiger-128, Snefru-128, Skein-256(128), Skein-512(128)'], 16 | [/^0x[a-f0-9]{32}$/, 'Lineage II C4'], 17 | [/^[a-f0-9]{32}:[a-z0-9]{16,32}$/, 'MD5(Joomla)'], 18 | [/^[a-f0-9]{32}:.{5}$/, 'MD5(IP.Board)'], 19 | [/^[a-f0-9]{32}:[a-z0-9]{8}$/, 'MD5(MyBB)'], 20 | [/^[a-f0-9]{40}$/, 'SHA-1, MySQL4.x, RIPEMD-160, Haval-160, SHA-1(MaNGOS), SHA-1(MaNGOS2), Tiger-160, Skein-256(160), Skein-512(160)'], 21 | [/^\*[a-f0-9]{40}$/, 'MySQL5.x'], 22 | [/^sha1\$.{0,32}\$[a-f0-9]{40}$/, 'SHA-1(Django)'], 23 | [/^0x0100[a-f0-9]{0,8}?[a-f0-9]{40}$/, 'MSSQL(2005), MSSQL(2008)'], 24 | [/^[a-f0-9]{48}$/, 'Haval-192, Tiger-192'], 25 | [/^[a-f0-9]{51}$/, 'MD5(Palshop)'], 26 | [/^\$S\$[a-z0-9\/\.]{52}$/, 'SHA-512(Drupal)'], 27 | [/^\$2a\$[0-9]{0,2}?\$[a-z0-9\/\.]{53}$/, 'Blowfish(OpenBSD)'], 28 | [/^[a-f0-9]{56}$/, 'SHA-224, Haval-224, Keccak-224, Skein-256(224), Skein-512(224)'], 29 | [/^[a-f0-9]{64}$/, 'SHA-256, RIPEMD-256, Haval-256, Snefru-256, GOST R 34.11-94, Keccak-256, Skein-256,Skein-512(256)'], 30 | [/^sha256\$.{0,32}\$[a-f0-9]{64}$/, 'SHA-256(Django)'], 31 | [/^\$5\$.{0,22}\$[a-z0-9\/\.]{43,69}$/, 'SHA-256(Unix)'], 32 | [/^[a-f0-9]{80}$/, 'RIPEMD-320'], 33 | [/^0x0100[a-f0-9]{0,8}?[a-f0-9]{80}$/, 'MSSQL(2000)'], 34 | [/^\$6\$.{0,22}\$[a-z0-9\/\.]{86}$/, 'SHA-512(Unix)'], 35 | [/^[a-f0-9]{96}$/, 'SHA-384, SHA3-384, Skein-512(384), Skein-1024(384)'], 36 | [/^sha384\$.{0,32}\$[a-f0-9]{96}$/, 'SHA-384(Django)'], 37 | [/^[a-f0-9]{128}$/, 'SHA-512, Whirlpool, SHA3-512, Skein-512, Skein-1024(512)'], 38 | [/^[a-f0-9]{256}$/, 'Skein-1024'], 39 | [/^({SSHA})?[a-z0-9\+\/]{32,38}?(==)?$/, 'SSHA-1'], 40 | [/^\(?[a-z0-9\+\/]{20}\)?$/, 'Lotus Domino'], 41 | [/^[a-f0-9]{32}:[a-z0-9]{2}$/, 'MD5(osCommerce)'], 42 | [/^[a-f0-9]{32}:[a-f0-9]{32}$/, 'SAM(LM_Hash:NT_Hash)'] 43 | ].freeze 44 | 45 | def check(input) 46 | PATTERNS.map { |i| i[1] if i[0].match(input) }.compact.uniq.join(', ') 47 | end 48 | 49 | def check_type(input, hashtype) 50 | PATTERNS.each do |i| 51 | return true if i[0].match(input) and i[1].start_with?(hashtype) 52 | end 53 | false 54 | end 55 | end 56 | -------------------------------------------------------------------------------- /screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sam-b/HashData/c9b56b2ac7bd87765ed5ed7c5340555718bd1d8c/screenshot.png -------------------------------------------------------------------------------- /test/hashdata_spec.rb: -------------------------------------------------------------------------------- 1 | require 'hashdata' 2 | require 'rspec' 3 | 4 | # Generated using the python "crypt" library for the string 'hashdata' with a salt of 'hashdata': 5 | # >> python version 2.7.1<< 6 | # import crypt 7 | # crypt.crypt('hashdata','hashdata') 8 | describe HashData do 9 | it 'recognizes a DES(UNIX) hash' do 10 | HashData.new.check_type('haLgYBnzoVJi6','DES(Unix)').should eq(true) 11 | end 12 | it 'recognizes Base64 encoded strings' do 13 | HashData.new.check_type('aGVsbG90aGVyZQ==','Base64').should eq(true) 14 | end 15 | end --------------------------------------------------------------------------------