Created
September 13, 2016 18:41
-
-
Save dwallraff/cf50b2ac861585f4feee7f5f27369838 to your computer and use it in GitHub Desktop.
Extract hashes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Extract md5 hashes | |
| egrep -oE '(^|[^a-fA-F0-9])[a-fA-F0-9]{32}(1|$)' *.txt | egrep -o '[a-fA-F0-9]{32}' > md5-hashes.txt | |
| # An alternative could be with sed | |
| sed -rn 's/.*[^a-fA-F0-9]([a-fA-F0-9]{32})[^a-fA-F0-9].*/1/p' *.txt > md5-hashes | |
| # Note: The above regexes can be used for SHA1, SHA256 and other unsalted hashes represented in hex. | |
| # The only thing you have to do is change the '{32}' to the corresponding length for your desired hash-type. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment