Refactor OSX preprocessor constants to read 'DARWIN'
[hashcat.git] / src / shared.c
index 7af0bd0..9e16c02 100644 (file)
@@ -6,7 +6,7 @@
  * License.....: MIT
  */
 
-#ifdef OSX
+#ifdef DARWIN
 #include <stdio.h>
 #endif
 
@@ -2382,7 +2382,7 @@ int tty_fix()
 }
 #endif
 
-#ifdef OSX
+#ifdef DARWIN
 static struct termios savemodes;
 static int havemodes = 0;
 
@@ -4325,7 +4325,7 @@ char *get_exec_path ()
 
   const int len = GetModuleFileName (NULL, exec_path, exec_path_len - 1);
 
-  #elif OSX
+  #elif DARWIN
 
   uint size = exec_path_len;
 
@@ -4462,7 +4462,7 @@ void truecrypt_crc32 (const char *filename, u8 keytab[64])
   myfree (buf);
 }
 
-#ifdef OSX
+#ifdef DARWIN
 int pthread_setaffinity_np (pthread_t thread, size_t cpu_size, cpu_set_t *cpu_set)
 {
   int core;
@@ -5730,7 +5730,7 @@ char **scan_directory (const char *path)
 
   if ((d = opendir (tmp_path)) != NULL)
   {
-    #ifdef OSX
+    #ifdef DARWIN
     struct dirent e;
 
     for (;;) {
@@ -5903,7 +5903,6 @@ char *strhashtype (const uint hash_mode)
     case   141: return ((char *) HT_00141); break;
     case   150: return ((char *) HT_00150); break;
     case   160: return ((char *) HT_00160); break;
-    case   190: return ((char *) HT_00190); break;
     case   200: return ((char *) HT_00200); break;
     case   300: return ((char *) HT_00300); break;
     case   400: return ((char *) HT_00400); break;
@@ -9176,7 +9175,7 @@ void stop_at_checkpoint ()
 
   if (data.restore_disable == 1)
   {
-    log_info ("WARNING: This feature is disabled when --restore-disable was specified");
+    log_info ("WARNING: This feature is disabled when --restore-disable is specified");
 
     return;
   }
@@ -9221,6 +9220,27 @@ void myquit ()
   data.devices_status = STATUS_QUIT;
 }
 
+void naive_escape (const char *cpath_real, char *cpath_escaped, const size_t cpath_escaped_len)
+{
+  const size_t len = strlen (cpath_real);
+
+  for (size_t in = 0, out = 0; in < len; in++, out++)
+  {
+    const u8 c = cpath_real[in];
+
+    if (c == ' ')
+    {
+      cpath_escaped[out] = '\\';
+
+      out++;
+    }
+
+    if (out == cpath_escaped_len) break;
+
+    cpath_escaped[out] = c;
+  }
+}
+
 void load_kernel (const char *kernel_file, int num_devices, size_t *kernel_lengths, const u8 **kernel_sources)
 {
   FILE *fp = fopen (kernel_file, "rb");
@@ -10505,7 +10525,7 @@ int wpa_parse_hash (char *input_buf, uint input_len, hash_t *hash_buf)
 
   if (salt_len > 36)
   {
-    log_info ("WARNING: The length of the ESSID is too long. The hccap file may be invalid or corrupted");
+    log_info ("WARNING: The ESSID length is too long, the hccap file may be invalid or corrupted");
 
     return (PARSER_SALT_LENGTH);
   }
@@ -12005,21 +12025,6 @@ int sha1_parse_hash (char *input_buf, uint input_len, hash_t *hash_buf)
   return (PARSER_OK);
 }
 
-int sha1linkedin_parse_hash (char *input_buf, uint input_len, hash_t *hash_buf)
-{
-  if ((input_len < DISPLAY_LEN_MIN_100) || (input_len > DISPLAY_LEN_MAX_100)) return (PARSER_GLOBAL_LENGTH);
-
-  u32 *digest = (u32 *) hash_buf->digest;
-
-  digest[0] = hex_to_u32 ((const u8 *) &input_buf[ 0]);
-  digest[1] = hex_to_u32 ((const u8 *) &input_buf[ 8]);
-  digest[2] = hex_to_u32 ((const u8 *) &input_buf[16]);
-  digest[3] = hex_to_u32 ((const u8 *) &input_buf[24]);
-  digest[4] = hex_to_u32 ((const u8 *) &input_buf[32]);
-
-  return (PARSER_OK);
-}
-
 int sha1axcrypt_parse_hash (char *input_buf, uint input_len, hash_t *hash_buf)
 {
   if ((input_len < DISPLAY_LEN_MIN_13300) || (input_len > DISPLAY_LEN_MAX_13300)) return (PARSER_GLOBAL_LENGTH);