diff --git a/src/episerver_fmt_plug.c b/src/episerver_fmt_plug.c index e37e0e8..4c72318 100644 --- a/src/episerver_fmt_plug.c +++ b/src/episerver_fmt_plug.c @@ -79,6 +79,14 @@ static struct custom_salt { unsigned char esalt[16]; } *cur_salt; +static void print_hex(unsigned char *str, int len) +{ + int i; + for (i = 0; i < len; ++i) + printf("%02x", str[i]); + printf("\n"); +} + static void init(struct fmt_main *pFmt) { @@ -110,21 +118,28 @@ static void *get_salt(char *ciphertext) cs.version = atoi(p); p = strtok(NULL, "*"); base64_decode(p, strlen(p), (char*)cs.esalt); + print_hex(cs.esalt, 8); free(keeptr); return (void *)&cs; } static void *get_binary(char *ciphertext) { - static unsigned char out[BINARY_SIZE+1]; + static union { + unsigned char c[BINARY_SIZE+1]; + ARCH_WORD dummy; + } buf; + unsigned char *out = buf.c; char *p; + int i; p = strrchr(ciphertext, '*') + 1; base64_decode(p, strlen(p), (char*)out); + print_hex(out, 8); return out; } static int binary_hash_0(void *binary) { return *(ARCH_WORD_32 *)binary & 0xf; } -static int binary_hash_1(void *binary) { return *(ARCH_WORD_32 *)binary & 0xff; } +static int binary_hash_1(void *binary) { int x = *(ARCH_WORD_32 *)binary & 0xff; int y = *(ARCH_WORD_32 *)binary; printf("abc %x\n", x); print_hex(&y, 4); return x;} static int binary_hash_2(void *binary) { return *(ARCH_WORD_32 *)binary & 0xfff; } static int binary_hash_3(void *binary) { return *(ARCH_WORD_32 *)binary & 0xffff; } static int binary_hash_4(void *binary) { return *(ARCH_WORD_32 *)binary & 0xfffff; } @@ -132,7 +147,7 @@ static int binary_hash_5(void *binary) { return *(ARCH_WORD_32 *)binary & 0xffff static int binary_hash_6(void *binary) { return *(ARCH_WORD_32 *)binary & 0x7ffffff; } static int get_hash_0(int index) { return crypt_out[index][0] & 0xf; } -static int get_hash_1(int index) { return crypt_out[index][0] & 0xff; } +static int get_hash_1(int index) { int x = crypt_out[index][0] & 0xff; printf("xyz %x\n", x); return x;} static int get_hash_2(int index) { return crypt_out[index][0] & 0xfff; } static int get_hash_3(int index) { return crypt_out[index][0] & 0xffff; } static int get_hash_4(int index) { return crypt_out[index][0] & 0xfffff; } @@ -167,6 +182,7 @@ static void crypt_all(int count) SHA1_Update(&ctx, cur_salt->esalt, 16); SHA1_Update(&ctx, passwordBuf, passwordBufSize); SHA1_Final((unsigned char*)crypt_out[index], &ctx); + printf("mno %x\n", crypt_out[index][0]); } else if(cur_salt->version == 1) { SHA256_CTX ctx;