diff --git a/common_passwords.txt b/common_passwords.txt
index 8c2b044c4460b9d91c8d88eb582a35ec7617e829..3a824c457d85fd86152c85d52269f7adce6cd624 100644
--- a/common_passwords.txt
+++ b/common_passwords.txt
@@ -1,4 +1,7 @@
 password
+pa55wo
+pa5sw0
+pas5wo
 123456
 12345678
 1234
diff --git a/crack.c b/crack.c
index 7919de3830d6d88aacece97bb0fd2a039d7d6847..0d7129d79e1b49ab984d4cfe526bd137b5a11e50 100644
--- a/crack.c
+++ b/crack.c
@@ -12,6 +12,7 @@
 #include <limits.h>
 #include <stdlib.h>
 #include <time.h>
+#include <ctype.h>
 #include <string.h>
 #include <sys/types.h>
 #include <sys/resource.h>
@@ -20,40 +21,55 @@
 
 
 
+#define PWD4_SIZE	320	/* pwd4sha256 size */
+#define PWD6_SIZE	640	/* pwd6sha256 size */
+#define ASCII_ST	32	/* ascII start value */
+#define ASCII_ED	127	/* ascII end value */
+#define INT_ST		48	/* ascII integer start value */
+#define INT_ED		58	/* ascII integer end value */
+#define ALPHA_ST	97	/* ascII little alpah start value */
+#define ALPHA_ED	124	/* ascII little alpah end value */
+
 /****************************************************************/
 int check_guess(BYTE secrets[], BYTE hash[], int size);
 int get_password(char *line, FILE *fp);
 /****************************************************************/
 
 
-
-int
-get_password(char *line, FILE *fp) {
+//get the password
+int get_password(char *line, FILE *fp) {
 	int i = 0, c;
+	
+	//if no eof or n or f, get the char
 	while(((c = fgetc(fp)) != EOF) && (c !='\n') && (c != '\r')) {
 		line[i++] = c;
 	}
+	
+	//add \0 at final place
 	line[i] = '\0';
 	return 1;
 }
 
 
 
-
+// check the guess result and return the flag
 int check_guess(BYTE secrets[], BYTE hash[], int size) {
-	//for(int i=0; i<32;i++){
-	//	printf("%02x",hash[i]);
-	//}
-	//printf("\n");
+	
+	//initialise the compare size and flag
 	int compare_size = 32;
 	int flag;
 	
+	//find how many turns should run
 	int turn = (size /32) + 1;
-	//printf("size is %d, turn is %d\n",size, turn);
-	//flag = true;
+	
+	//for each turn compare the hash value between data and secret
 	for(int i = 1 ; i < turn ; i++) {
 		flag = -1;
+		
+		
 		for(int k = (i - 1) *compare_size; k < i *compare_size; k++) {
+			
+			//if not mach return 0
 			if (secrets[k] != hash[k-((i - 1) *compare_size)]) {
 				flag = 0;
 				break;
@@ -62,16 +78,14 @@ int check_guess(BYTE secrets[], BYTE hash[], int size) {
 			}
 			
 		}
+		
+		// if match, return the place of the secret
 		if(flag == 1){
-			//int num;
-			//num = flag * i;
-			//printf("this is true for %d\n", i);
-			//printf("true!!!!\n");
-			//printf("return value should be %d\n",num);
+
 			return flag * i;
 		}
 	}
-	//printf("%d\n", flag);
+
 	return flag;
 }
 
@@ -82,12 +96,12 @@ int main( int argc, char **argv )
 	/* check we have 0 argument, test for guessing password*/
 	if( argc < 2 )
 	{	
-		
+		//open fp and fp1 for pwd4sha256 and write found_pwd
 		FILE *fp;
 		FILE *fp1;
 		int pwd4_size;
-		fp1 = fopen("out.txt", "w");
-		BYTE secrets[320];
+		fp1 = fopen("found_pwds.txt", "w");
+		BYTE secrets[PWD4_SIZE];
 		fp = fopen("pwd4sha256", "rb");
 		fread(secrets, 320, 1, fp);
 		/*Move file point at the end of file.*/
@@ -97,37 +111,37 @@ int main( int argc, char **argv )
     	pwd4_size=ftell(fp);
 		
 		fseek(fp, 0, SEEK_SET); 
-		printf("size is  %d\n", pwd4_size);
-		for(int i = 0; i < 320; i++){
-			
-			printf("%02x", secrets[i]);
-			if(((i+1) %32) == 0) {
-				printf("\n");
-			}
-		}
-		//printf("all done\n");
+		
 		fclose(fp);
+		
+		//initialise guess needed array and text
 		char guess[5];
 		int secret_num;
 		SHA256_CTX ctx;
 		BYTE data[SHA256_BLOCK_SIZE];
-		for(int i = 32; i < 127; i++) {
-			for(int j = 32; j < 127; j++) {
-				for(int l = 32; l < 127; l++) {
-					for(int k = 32; k < 127; k++) {
+		
+		//find for whole ascII
+		for(int i = ASCII_ST; i < ASCII_ED; i++) {
+			for(int j = ASCII_ST; j < ASCII_ED; j++) {
+				for(int l = ASCII_ST; l < ASCII_ED; l++) {
+					for(int k = ASCII_ST; k < ASCII_ED; k++) {
+						
+						//store into guess
 						sprintf(guess, "%c%c%c%c", i, j, l, k);
-						//printf("%s\n",guess);	
-										
+
+						//hash the guess				
 						sha256_init(&ctx);
 						sha256_update(&ctx, (BYTE*)guess, strlen(guess));
 						sha256_final(&ctx, data);
+						
+						//chech the hash 
 						if (check_guess(secrets, data, pwd4_size) > 0) {
 							secret_num = check_guess(secrets, data, pwd4_size);
 							printf("%s %d\n",guess, secret_num);
 							fprintf(fp1, "%s %d\n", guess, secret_num);							
 						}
 						
-						//printf("%s\n", guess);
+
 					}
 				}
 			}
@@ -135,8 +149,10 @@ int main( int argc, char **argv )
 		
 		guess[5] = '\0';
 		
+		
+		//open the pwd6sha256
 		FILE *fp3;
-		BYTE long_secrets[640];
+		BYTE long_secrets[PWD6_SIZE];
 		fp3 = fopen("pwd6sha256", "rb");
 		fread(long_secrets, 640, 1, fp3);
 		int pwd6_size;
@@ -147,36 +163,36 @@ int main( int argc, char **argv )
     	pwd6_size=ftell(fp3);
     	
     	fseek(fp3, 0, SEEK_SET);
-    	printf("size is  %d\n", pwd6_size);
-		for(int i = 0; i < 640; i++){
-			
-			printf("%02x", long_secrets[i]);
-			if(((i+1) %32) == 0) {
-				printf("\n");
-			}
-		}
-		printf("\n");
-		
+    	
+
+		//create longer gusee for 6 password guess
 		char long_guess[7];
 		int long_secret_num;
 		SHA256_CTX long_ctx;
 		BYTE long_data[SHA256_BLOCK_SIZE];
-		for(int i = 48; i < 58; i++) {
-			for(int j = 48; j < 58; j++) {
-				for(int l = 48; l < 58; l++) {
-					for(int k = 48; k < 58; k++) {
-						for(int n = 48; n < 58; n++) {
-							for(int m = 48; m < 58; m++) {
+		
+		//check all number guess
+		for(int i = INT_ST; i < INT_ED; i++) {
+			for(int j = INT_ST; j < INT_ED; j++) {
+				for(int l = INT_ST; l < INT_ED; l++) {
+					for(int k = INT_ST; k < INT_ED; k++) {
+						for(int n = INT_ST; n < INT_ED; n++) {
+							for(int m = INT_ST; m < INT_ED; m++) {
+								
+								//store into long guess
 								sprintf(long_guess, "%c%c%c%c%c%c", i, j, l, k, n, m);
-								//printf("%s\n",guess);	
-												
+
+								//hash the long guess				
 								sha256_init(&long_ctx);
 								sha256_update(&long_ctx, (BYTE*)long_guess, strlen(long_guess));
 								sha256_final(&long_ctx, long_data);
+								
+								//chech the hash
 								if (check_guess(long_secrets, long_data, pwd6_size) > 0) {
 									long_secret_num = check_guess(long_secrets, long_data, pwd6_size);
+									
+									//add 10 for 10 later password
 									long_secret_num = long_secret_num + 10;
-									//printf("long secret num should be %d\n", long_secret_num);
 									printf("%s %d\n",long_guess, long_secret_num);
 									fprintf(fp1, "%s %d\n", long_guess, long_secret_num);							
 								}
@@ -188,25 +204,33 @@ int main( int argc, char **argv )
 		}
 		long_guess[7] = '\0';
 		
+		//create alpha gusee for 6 password guess
 		char alpha_guess[7];
 		int alpha_secret_num;
 		SHA256_CTX alpha_ctx;
 		BYTE alpha_data[SHA256_BLOCK_SIZE];
-		for(int i = 97; i < 124; i++) {
-			for(int j = 97; j < 124; j++) {
-				for(int l = 97; l < 124; l++) {
-					for(int k = 97; k < 124; k++) {
-						for(int n = 97; n < 124; n++) {
-							for(int m = 97; m < 124; m++) {
+		
+		//check all little alpha guess
+		for(int i = ALPHA_ST; i < ALPHA_ED; i++) {
+			for(int j = ALPHA_ST; j < ALPHA_ED; j++) {
+				for(int l = ALPHA_ST; l < ALPHA_ED; l++) {
+					for(int k = ALPHA_ST; k < ALPHA_ED; k++) {
+						for(int n = ALPHA_ST; n < ALPHA_ED; n++) {
+							for(int m = ALPHA_ST; m < ALPHA_ED; m++) {								
+								//store into little alpha guess
 								sprintf(alpha_guess, "%c%c%c%c%c%c", i, j, l, k, n, m);
-								//printf("%s\n",guess);													
+								
+								//hash the little alpha guess			
 								sha256_init(&alpha_ctx);
 								sha256_update(&alpha_ctx, (BYTE*)alpha_guess, strlen(alpha_guess));
 								sha256_final(&alpha_ctx, alpha_data);
+								
+								//chech the hash
 								if (check_guess(long_secrets, alpha_data, pwd6_size) > 0) {
 									alpha_secret_num = check_guess(long_secrets, alpha_data, pwd6_size);
+
+									//add 10 for 10 later password
 									alpha_secret_num = alpha_secret_num + 10;
-									//printf("long secret num should be %d\n", long_secret_num);
 									printf("%s %d\n",alpha_guess, alpha_secret_num);
 									fprintf(fp1, "%s %d\n", alpha_guess, alpha_secret_num);							
 								}
@@ -218,22 +242,47 @@ int main( int argc, char **argv )
 		}
 		alpha_guess[7] = '\0';
 		
+		//close all file
+		fclose(fp1);
+		fclose(fp3);
+		
 		return 0;
 	}
 
 	if( argc == 2 )
 	{
-		//if (isdigit(argv[1]) == 0) {
-        //	fprintf(stderr, "please entre a integer\n");
-        //	return 0;
-    	//} 
+		// get the guess number and open diriction
     	int guess_num = atoi(argv[1]);
     	FILE *fp;
 		char line[10000];
+		char guess_word[100000][7];
 		fp = fopen("common_passwords.txt", "r");
-		for(int i = 0; i < guess_num; i++) {
+		int fp_size;
+		fseek(fp, 0, SEEK_END);
+    	fp_size=ftell(fp);
+    	fseek(fp, 0, SEEK_SET);
+    	
+    	//set all password into direction
+		for(int i = 0; i < fp_size; i++) {
 			get_password(line, fp);
-			printf("%s\n", line);
+			strncpy(guess_word[i], line, 6);
+		}
+		
+		//print out guess based on require number
+		for(int i = 0; i < guess_num; i++) {
+			if(strlen(guess_word[i]) < 6 && strlen(guess_word[i]) > 0) {
+				for(int k = (strlen(guess_word[i]) - 1); k < 6; k++){
+					guess_word[i][k] = 'a';
+				}
+				guess_word[i][6] = '\n'; 
+			}
+			if(strlen(guess_word[i]) == 0) {
+				for(int k = 0; k < 6; k++){
+					guess_word[i][k] = 'a';
+				}
+			}
+			 
+			printf("%s\n", guess_word[i]);
 		}
 		
 		return 0;
@@ -241,6 +290,7 @@ int main( int argc, char **argv )
 	
 	if( argc == 3 )
 	{	
+		//open argument 1 and 2 file
 		FILE *fp1;
 		fp1 = fopen(argv[2], "rb");
 		int fp1_size;
@@ -249,17 +299,12 @@ int main( int argc, char **argv )
     	fseek(fp1, 0, SEEK_SET);
 		BYTE secrets[fp1_size];
 		fread(secrets, fp1_size, 1, fp1);
-		for(int i = 0; i < fp1_size; i++){
-			
-			printf("%02x", secrets[i]);
-			if(((i+1) %32) == 0) {
-				printf("\n");
-			}
-		}
 		FILE *fp;
 		char line[10000];
 		fp = fopen(argv[1], "r");
 		int secret_num;
+		
+		//check the password from first argument to the second
 		for(int i = 0; i < 10000 ; i++) {
 			get_password(line, fp);
 			SHA256_CTX ctx;
@@ -272,6 +317,8 @@ int main( int argc, char **argv )
 				printf("%s %d\n", line, secret_num);							
 			}
 		}
+		
+		//close all files
 		fclose(fp);
 		fclose(fp1);
 		return 0;
diff --git a/found_pwds.txt b/found_pwds.txt
new file mode 100644
index 0000000000000000000000000000000000000000..fb8379058880b225a8c61f2a9cae7edb38fef696
--- /dev/null
+++ b/found_pwds.txt
@@ -0,0 +1,23 @@
+4226 8
+5226 3
+5236 4
+5237 5
+8686 6
+mcac 1
+oca{ 10
+reng 2
+tuyy 9
+weij 7
+090909 25
+360258 11
+369258 13
+379258 12
+469258 29
+asdzxc 27
+fastca 21
+kakash 17
+newcas 16
+oeotak 23
+wdovan 20
+weijie 19
+wicked 30
diff --git a/outcomeone.txt b/outcomeone.txt
deleted file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000
diff --git a/project2.rar b/project2.rar
new file mode 100644
index 0000000000000000000000000000000000000000..3d3fe1c7797367aa1a192ec65d4108e351d31a1f
Binary files /dev/null and b/project2.rar differ