6 // #include "hash_wrappers.h"
11 #define TC_HIDDEN_VOLUME_OFFSET 1536
13 #define TC_HEADER_SZ 448
18 fprintf(stderr,"trueCRACK v%f\m",version);
19 fprintf(stderr,"usage:\n\t%s tc_volume wordlist starting_word",name);
28 inline void xor_l2(uint8_t * b1, uint8_t * b2, uint8_t * b3, uint32_t len) {
29 for (uint32_t i = 0; i < len; i ++)
30 b3[i] = (uint8_t) b1[i] ^ b2[i];
33 int hmac_init(hash_t * hash) {
34 o_pad = malloc(hash->block_sz);
37 i_pad = malloc(hash->block_sz);
40 memset(o_pad, 0x5c, hash->block_sz);
41 memset(i_pad, 0x36, hash->block_sz);
43 tmp_key = malloc(hash->block_sz);
49 void hmac(hash_t * hash, uint8_t * key, uint32_t key_len, uint8_t * message, uint32_t message_len, uint8_t * out, uint32_t out_len) {
50 // out = hash(K^opad ++ hash(K^ipad ++ message)
53 if ( key_len > hash->block_sz ) {
54 //key = hash->digest(key)
55 hash->digest(key, key_len, NULL, 0, key, key_len); // this may cause issues....
56 key_len = hash->digest_sz
59 xor_l2(key,opad,key_len);
60 memset(key+hash->digest,0x5c,key_len-
63 int main (int argc, char ** argv) {
68 FILE * tc_volume_file = fopen(argv[1], "rb");
69 FILE * wordlist_file = fopen(argv[2], "r" );
71 uint8_t salt [TC_SALT_SZ+4];
72 uint8_t header [TC_HEADER_SZ];
73 uint8_t header_hidden [TC_HEADER_SZ];
75 size_t s = fread(tc_volume_file,1,TC_SALT_SZ,salt);
80 s = fread(tc_volume_file,1,TC_HEADER_SZ,header);
81 if (s < TC_HEADER_SZ) {
85 fseek ( tc_volume_file , TC_HIDDEN_VOLUME_OFFSET , SEEK_SET );
86 s = fread(tc_volume_file,1,TC_HEADER_SZ,header_hidden);
87 if (s < TC_HEADER_SZ) {
91 int ret = hmac_init();
96 uint8_t password [TC_PASSWORD_MAX];
98 while ( !feof(wordlist_file) ) {
100 read_line(wordlist_file, password);
101 PBKDF2(hmac_???, password, sizeof(password), salt, sizeof(salt), iterations, derived_key, derived_key_len);