From aa5c8d8ff5522df637d2aba795a2dc427c1da176 Mon Sep 17 00:00:00 2001
From: magnum <magnum>
Date: Sat, 17 Sep 2011 00:53:04 +0200
Subject: [PATCH 8/8] options.encoding_7_bit -> options.ascii

---
 src/NT_fmt_plug.c        |    2 +-
 src/md5_gen_fmt.c        |   26 +++++++++++++-------------
 src/mscash1_fmt_plug.c   |    2 +-
 src/mssql-old_fmt_plug.c |    6 +++---
 src/mssql05_fmt_plug.c   |    2 +-
 src/options.c            |    4 ++--
 src/options.h            |    2 +-
 src/sapG_fmt_plug.c      |    2 +-
 8 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/src/NT_fmt_plug.c b/src/NT_fmt_plug.c
index 20809d0..89db00f 100644
--- a/src/NT_fmt_plug.c
+++ b/src/NT_fmt_plug.c
@@ -264,7 +264,7 @@ static void fmt_NT_init(struct fmt_main *pFmt)
 		tests[4].plaintext = "\xE2\x82\xAC\xE2\x82\xAC";
 		tests[4].ciphertext = "$NT$682467b963bb4e61943e170a04f7db46";
 	} else {
-		if (options.encoding_7_bit || options.iso8859_1) {
+		if (options.ascii || options.iso8859_1) {
 #if defined (NT_X86_64)
 			fmt_NT.methods.crypt_all = nt_crypt_all_8859_1_x86_64;
 #endif
diff --git a/src/md5_gen_fmt.c b/src/md5_gen_fmt.c
index 3dfb783..c212de7 100644
--- a/src/md5_gen_fmt.c
+++ b/src/md5_gen_fmt.c
@@ -2622,7 +2622,7 @@ static inline void __append_string(char *Str, unsigned len)
 				__SSE_append_string_to_input((unsigned char*)(&input_buf[idx]),idx_mod,Str,len,bf_ptr,1);
 			}
 		} else {
-			if (!options.encoding_7_bit && !options.iso8859_1) {
+			if (!options.ascii && !options.iso8859_1) {
 				UTF16 utf16Str[27+1]; // 27 chars is 'max' that fits in SSE without overflow, so that is where we limit it at now
 				int outlen;
 
@@ -2651,7 +2651,7 @@ static inline void __append_string(char *Str, unsigned len)
 	}
 #endif
 	if (md5_unicode_convert) {
-		if (!options.encoding_7_bit && !options.iso8859_1) {
+		if (!options.ascii && !options.iso8859_1) {
 			UTF16 utf16Str[256+1];
 			int outlen;
 			outlen = enc_to_utf16(utf16Str, 256, (unsigned char*)Str, len) * sizeof(UTF16);
@@ -2717,7 +2717,7 @@ static inline void __append2_string(char *Str, unsigned len)
 				__SSE_append_string_to_input((unsigned char*)(&input_buf2[idx]),idx_mod,Str,len,bf_ptr,1);
 			}
 		} else {
-			if (!options.encoding_7_bit && !options.iso8859_1) {
+			if (!options.ascii && !options.iso8859_1) {
 				UTF16 utf16Str[27+1]; // 27 chars is 'max' that fits in SSE without overflow, so that is where we limit it at now
 				int outlen;
 
@@ -2746,7 +2746,7 @@ static inline void __append2_string(char *Str, unsigned len)
 	}
 #endif
 	if (md5_unicode_convert) {
-		if (!options.encoding_7_bit && !options.iso8859_1) {
+		if (!options.ascii && !options.iso8859_1) {
 			UTF16 utf16Str[256+1];
 			int outlen;
 			outlen = enc_to_utf16(utf16Str, 256, (unsigned char*)Str, len) * sizeof(UTF16);
@@ -2917,7 +2917,7 @@ void MD5GenBaseFunc__append_keys()
 			unsigned idx_mod = j&(MMX_COEF-1);
 			unsigned bf_ptr = (total_len[idx] >> ((32/MMX_COEF)*idx_mod)) & 0xFF;
 			if (md5_unicode_convert) {
-				if (!options.encoding_7_bit && !options.iso8859_1) {
+				if (!options.ascii && !options.iso8859_1) {
 					UTF16 utf16Str[27+1]; // 27 chars is 'max' that fits in SSE without overflow, so that is where we limit it at now
 					int outlen;
 					outlen = enc_to_utf16(utf16Str, 27, (unsigned char*)saved_key[j], saved_key_len[j]) * sizeof(UTF16);
@@ -2938,7 +2938,7 @@ void MD5GenBaseFunc__append_keys()
 	}
 #endif
 	if (md5_unicode_convert) {
-		if (!options.encoding_7_bit && !options.iso8859_1) {
+		if (!options.ascii && !options.iso8859_1) {
 			for (j = 0; j < m_count; ++j) {
 				int z;
 				unsigned char *cp, *cpi;
@@ -3002,7 +3002,7 @@ void MD5GenBaseFunc__append_keys2()
 			unsigned idx_mod = j&(MMX_COEF-1);
 			unsigned bf_ptr = (total_len2[idx] >> ((32/MMX_COEF)*idx_mod)) & 0xFF;
 			if (md5_unicode_convert) {
-				if (!options.encoding_7_bit && !options.iso8859_1) {
+				if (!options.ascii && !options.iso8859_1) {
 					UTF16 utf16Str[27+1]; // 27 chars is 'max' that fits in SSE without overflow, so that is where we limit it at now
 					int outlen;
 					outlen = enc_to_utf16(utf16Str, 27, (unsigned char*)saved_key[j], saved_key_len[j]) * sizeof(UTF16);
@@ -3023,7 +3023,7 @@ void MD5GenBaseFunc__append_keys2()
 	}
 #endif
 	if (md5_unicode_convert) {
-		if (!options.encoding_7_bit && !options.iso8859_1) {
+		if (!options.ascii && !options.iso8859_1) {
 			for (j = 0; j < m_count; ++j) {
 				int z;
 				unsigned char *cp, *cpi;
@@ -4498,7 +4498,7 @@ void MD5GenBaseFunc__overwrite_salt_to_input1_no_size_fix()
 #ifdef MMX_COEF
 	if (md5_gen_use_sse==1) {
 		if (md5_unicode_convert) {
-			if (!options.encoding_7_bit && !options.iso8859_1) {
+			if (!options.ascii && !options.iso8859_1) {
 				UTF16 utf16Str[27+1]; // 27 chars is 'max' that fits in SSE without overflow, so that is where we limit it at now
 				int outlen;
 				outlen = enc_to_utf16(utf16Str, 27, (unsigned char*)cursalt, saltlen) * sizeof(UTF16);
@@ -4519,7 +4519,7 @@ void MD5GenBaseFunc__overwrite_salt_to_input1_no_size_fix()
 	}
 #endif
 	if (md5_unicode_convert) {
-		if (!options.encoding_7_bit && !options.iso8859_1) {
+		if (!options.ascii && !options.iso8859_1) {
 			UTF16 utf16Str[256+1];
 			int outlen;
 			outlen = enc_to_utf16(utf16Str, 256, (unsigned char*)cursalt, saltlen) * sizeof(UTF16);
@@ -4571,7 +4571,7 @@ void MD5GenBaseFunc__overwrite_salt_to_input2_no_size_fix()
 #ifdef MMX_COEF
 	if (md5_gen_use_sse==1) {
 		if (md5_unicode_convert) {
-			if (!options.encoding_7_bit && !options.iso8859_1) {
+			if (!options.ascii && !options.iso8859_1) {
 				UTF16 utf16Str[27+1]; // 27 chars is 'max' that fits in SSE without overflow, so that is where we limit it at now
 				int outlen;
 				outlen = enc_to_utf16(utf16Str, 27, (unsigned char*)cursalt, saltlen) * sizeof(UTF16);
@@ -4592,7 +4592,7 @@ void MD5GenBaseFunc__overwrite_salt_to_input2_no_size_fix()
 	}
 #endif
 	if (md5_unicode_convert) {
-		if (!options.encoding_7_bit && !options.iso8859_1) {
+		if (!options.ascii && !options.iso8859_1) {
 			UTF16 utf16Str[256+1];
 			int outlen;
 			outlen = enc_to_utf16(utf16Str, 256, (unsigned char*)cursalt, saltlen) * sizeof(UTF16);
@@ -6565,7 +6565,7 @@ int md5_gen_SETUP(MD5_GEN_Setup *Setup, struct fmt_main *pFmt)
 				i = 0;
 			}
 			if (Setup->pPreloads[i].ciphertext[0] == 'A' && Setup->pPreloads[i].ciphertext[1] == '=') {
-				if (!options.encoding_7_bit && !options.iso8859_1)
+				if (!options.ascii && !options.iso8859_1)
 					continue;
 				pfx[cnt].ciphertext = str_alloc_copy(&Setup->pPreloads[i].ciphertext[2]);
 			}
diff --git a/src/mscash1_fmt_plug.c b/src/mscash1_fmt_plug.c
index 6147d96..2de7a83 100644
--- a/src/mscash1_fmt_plug.c
+++ b/src/mscash1_fmt_plug.c
@@ -139,7 +139,7 @@ static void init(struct fmt_main *pFmt)
 		tests[1].plaintext = "\xC3\xBC";         // German u-umlaut in UTF-8
 		tests[2].ciphertext = "M$user#9121790702dda0fa5d353014c334c2ce";
 		tests[2].plaintext = "\xe2\x82\xac\xe2\x82\xac"; // 2 x Euro signs
-	} else if (options.encoding_7_bit || options.iso8859_1) {
+	} else if (options.ascii || options.iso8859_1) {
 		tests[1].ciphertext = "M$\xFC#48f84e6f73d6d5305f6558a33fa2c9bb";
 		tests[1].plaintext = "\xFC";         // German u-umlaut in UTF-8
 		tests[2].ciphertext = "M$\xFC\xFC#593246a8335cf0261799bda2a2a9c623";
diff --git a/src/mssql-old_fmt_plug.c b/src/mssql-old_fmt_plug.c
index 959252c..b9f3a58 100644
--- a/src/mssql-old_fmt_plug.c
+++ b/src/mssql-old_fmt_plug.c
@@ -144,10 +144,10 @@ extern struct fmt_main fmt_mssql;
 
 static void mssql_init(struct fmt_main *pFmt)
 {
-	if (options.encoding_7_bit) {
+	if (options.ascii) {
 		// The 'proper' default encoding for mssql IS 8859-1 the test suite will have a TON of failures, unless this
 		// is set this way.  All of the data IN that test suite, was made using MSSQL.
-		options.encoding_7_bit = 0;
+		options.ascii = 0;
 		options.iso8859_1 = 1;
 		options.encodingStr = "ISO-8859-1";
 	}
@@ -161,7 +161,7 @@ static void mssql_init(struct fmt_main *pFmt)
 		fmt_mssql.methods.set_key = mssql_set_key_enc;
 		fmt_mssql.params.plaintext_length = PLAINTEXT_LENGTH * 3;
 	}
-	else if (options.iso8859_1 || options.encoding_7_bit) {
+	else if (options.iso8859_1 || options.ascii) {
 		; // do nothing
 	}
 	else {
diff --git a/src/mssql05_fmt_plug.c b/src/mssql05_fmt_plug.c
index a107283..77f1d10 100644
--- a/src/mssql05_fmt_plug.c
+++ b/src/mssql05_fmt_plug.c
@@ -175,7 +175,7 @@ static void mssql05_init(struct fmt_main *pFmt)
 		fmt_mssql05.methods.set_key = mssql05_set_key_utf8;
 		fmt_mssql05.params.plaintext_length = PLAINTEXT_LENGTH * 3;
 	}
-	else if (options.iso8859_1 || options.encoding_7_bit) {
+	else if (options.iso8859_1 || options.ascii) {
 		; // do nothing
 	}
 	else {
diff --git a/src/options.c b/src/options.c
index f2c7371..ec8aa88 100644
--- a/src/options.c
+++ b/src/options.c
@@ -453,11 +453,11 @@ void opt_init(char *name, int argc, char **argv)
 	options.utf8 = options.iso8859_1 = options.koi8_r = options.cp1251 = options.cp866 =
 	options.cp1252 = options.iso8859_15 = options.cp437 = options.cp850 = options.cp858 = options.cp737 = 0;
 	// by 'default' we are setup in 7 bit ascii mode (for rules).
-	options.encoding_7_bit = 1;
+	options.ascii = 1;
 	options.encodingStr = "";
 	if ( (options.flags & FLG_INP_ENCODING) && options.encoding) {
 		// Ok, check a 'few' valid things for utf8
-		options.encoding_7_bit = 0;
+		options.ascii = 0;
 		if (!strcasecmp(options.encoding, "utf8")||!strcasecmp(options.encoding, "utf-8")) {
 			options.utf8 = 1;
 			options.encodingStr = "UTF-8";
diff --git a/src/options.h b/src/options.h
index 4f42c6d..1a69c94 100644
--- a/src/options.h
+++ b/src/options.h
@@ -155,7 +155,7 @@ struct options_main {
 /* The canonical name of chosen encoding. User might have said 'koi8r' but
    this string will be 'KOI8-R'. An empty string means default/old-style */
 	char *encodingStr;
-	int encoding_7_bit;  // if NO other charset is used, we set this to 1.  This tells us to user 7 bit ASCII.
+	int ascii;  // if NO other charset is used, we set this to 1.  This tells us to user 7 bit ASCII.
 	int utf8;
 	int iso8859_1;
 	int koi8_r;
diff --git a/src/sapG_fmt_plug.c b/src/sapG_fmt_plug.c
index 4507fa9..5e1267b 100644
--- a/src/sapG_fmt_plug.c
+++ b/src/sapG_fmt_plug.c
@@ -139,7 +139,7 @@ static void sapcodvng_set_key(char *key, int index)
 	// 0. translate candidates to UTF-8
 	if (options.utf8)
 		strnzcpy((char*)trPassword, key, PLAINTEXT_LENGTH + 1);
-	else if (!options.encoding_7_bit) {
+	else if (!options.ascii) {
 		// convert from codepage -> Unicode -> UTF-8
 		UTF16 tmp16[PLAINTEXT_LENGTH + 1];
 #if ARCH_LITTLE_ENDIAN
-- 
1.7.4.1

