}
}
+// stolen from princeprocessor ;)
+
+typedef struct
+{
+ FILE *fp;
+
+ char buf[BUFSIZ];
+ int len;
+
+} out_t;
+
+static void out_flush (out_t *out)
+{
+ fwrite (out->buf, 1, out->len, out->fp);
+
+ out->len = 0;
+}
+
+static void out_push (out_t *out, const u8 *pw_buf, const int pw_len)
+{
+ char *ptr = out->buf + out->len;
+
+ memcpy (ptr, pw_buf, pw_len);
+
+ ptr[pw_len] = '\n';
+
+ out->len += pw_len + 1;
+
+ if (out->len >= BUFSIZ - 100)
+ {
+ out_flush (out);
+ }
+}
+
static void process_stdout (hc_device_param_t *device_param, const uint pws_cnt)
{
- char out_buf[HCBUFSIZ] = { 0 };
+ out_t out;
+
+ out.fp = stdout;
+ out.len = 0;
uint plain_buf[16] = { 0 };
if (plain_len > data.pw_max) plain_len = data.pw_max;
- format_output (stdout, out_buf, plain_ptr, plain_len, 0, NULL, 0);
+ out_push (&out, plain_ptr, plain_len);
}
}
}
if (plain_len > data.pw_max) plain_len = data.pw_max;
}
- format_output (stdout, out_buf, plain_ptr, plain_len, 0, NULL, 0);
+ out_push (&out, plain_ptr, plain_len);
}
}
}
plain_len = data.css_cnt;
- format_output (stdout, out_buf, plain_ptr, plain_len, 0, NULL, 0);
+ out_push (&out, plain_ptr, plain_len);
}
}
}
plain_len += start + stop;
- format_output (stdout, out_buf, plain_ptr, plain_len, 0, NULL, 0);
+ out_push (&out, plain_ptr, plain_len);
}
}
}
plain_len += start + stop;
- format_output (stdout, out_buf, plain_ptr, plain_len, 0, NULL, 0);
+ out_push (&out, plain_ptr, plain_len);
}
}
}
+
+ out_flush (&out);
}
static void save_hash ()