Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.File;
- import java.io.FileInputStream;
- import java.io.IOException;
- import java.util.ArrayList;
- import java.util.Scanner;
- import java.util.zip.CRC32;
- public class Main {
- public static void main(String[] args) throws IOException {
- CRC32 crc32 = new CRC32();
- String guessHash = "BA02B6E1";
- File infile = new File("C:\\Users\\User\\Desktop\\pass.txt");
- FileInputStream in = new FileInputStream(infile);
- Scanner scanner = new Scanner(in);
- ArrayList <String> words = new ArrayList<String>();
- while(scanner.hasNext()){
- words.add(scanner.nextLine());
- }
- System.out.println("There are " + words.size() + " in dictionary file");
- for(int i = 0; i < words.size(); i++) {
- String word1 = null;
- crc32.reset();
- word1 = words.get(i);
- crc32.update(word1.getBytes());
- long hash1 = crc32.getValue();
- String hash2 = Long.toHexString(hash1).toUpperCase();
- if (hash2.equals(guessHash)){
- System.out.println(word1);
- break;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement