From 646ef06f3a669f3c5d282083dd7bbe77b9953064 Mon Sep 17 00:00:00 2001 From: Abhisha Nirmalathas <a.nirmalathas1@student.unimelb.edu.au> Date: Thu, 23 May 2019 20:35:02 +1000 Subject: [PATCH] any length --- decrypt.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/decrypt.c b/decrypt.c index 55a2dc9..82a6f8a 100644 --- a/decrypt.c +++ b/decrypt.c @@ -132,9 +132,12 @@ void check_hashed_passwords(char *password_list, int n_guesses,char *file_name){ memset(line, 0, 100000); SHA256_CTX ctx; int hash; + char *ret; + const char newline = '\n'; while (fgets(line, sizeof(line), pwrd_file) && remaining_hashes(password_hashes) > 0){ - line[6] = '\0'; - + // line[6] = '\0'; + ret = strchr(line, newline); + line[strlen(line)-strlen(ret)] = '\0'; sha256_init(&ctx); sha256_update(&ctx, (BYTE*)line, strlen(line)); BYTE guess[32]; -- GitLab