Login Register






Fast I/O filter_list
Author
Message
Fast I/O #1
I'm having trouble with my I/O performance, I have this piece of code which reads a file of 2MB and then converts each text to it's Hash and then compares it with a given hash. Now It's talking way too much time.

I tried picking a word from the mid of the list but still it's taking a very very long time, I can't seem to find the problem or either my method sucks. I did some googling and people were suggesting to use Memory Mapped files but I'm not familiar with em.

Code:
Code:
int main() { //menu(); MD5 md5; char y[32]; //Load Dictionary File std::ifstream dict ("test.txt"); if(check_dict("test.txt")) { //Char Limit char test[25]; //Get the items from the file for(int i = 0; i < count_file("test.txt"); i++) { dict >> test; strncpy(y, test, sizeof(y)); if(md5.digestString(y) == "f0775b2755cb09221eb72ddf843a7d05") { std::cout << "Your cracked string is: " << test << std::endl; } else { std::cout << "Fail Hash...." << std::endl; } } } system("pause"); }


The point is I need to reduce the time taken, An idea which I have is:

Split the text file into two, Create 2 threads and give each half to the respective thread then do the work but this is just my assumption, Haven't tested it yet.
My Blog: http://www.procurity.wordpress.com
Donations: 1HLjiSbnWMpeQU46eUVCrYdbkrtduX7snG






Messages In This Thread
Fast I/O - by Ex094 - 03-13-2014, 06:52 AM