int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) { const u32 *digest = (const u32 *) digest_buf; u32 tmp[4]; tmp[0] = digest[0]; tmp[1] = digest[1]; tmp[2] = digest[2]; tmp[3] = digest[3]; u8 *out_buf = (u8 *) line_buf; int out_len = 0; u32_to_hex (tmp[0], out_buf + out_len); out_len += 8; u32_to_hex (tmp[1], out_buf + out_len); out_len += 8; u32_to_hex (tmp[2], out_buf + out_len); out_len += 8; u32_to_hex (tmp[3], out_buf + out_len); out_len += 8; out_buf[out_len] = hashconfig->separator; out_len += 1; out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len); return out_len; }
void static render_slots() { int i; char slot_number_label[2+1]; char static slot_address_label[] = "0x12345678"; u32 slot_address; VoidFunction **reset_vector; int left; int bottom; // If a slot has been chosen then show the other slots in muted colors for ( i = 0; i < PAGES; i += 1) { u16 color = (UNDEFINED == chosen_slot || i / 8 == chosen_slot) ? VALUE_COLOR : MUTED_COLOR; left = ( i < 16) ? 0 : (SCREEN_WIDTH / 2); bottom = SCREEN_HEIGHT - FONT_HEIGHT * (2 + i % 16); slot_number_label[ 0] = (i < 10) ? ' ' : ('0'+ i / 10); slot_number_label[ 1] = '0'+ (i % 10); slot_number_label[ 2] = '\0'; __Display_Str( left, bottom, color, 0, slot_number_label); // The slot address is not as interesting as the Reset vector and the slot // number, so show it in a muted color slot_address = FIRST_PAGE + PAGE_SIZE * i; u32_to_hex( slot_address, &slot_address_label[2]); __Display_Str( (left + FONT_WIDTH * 3), bottom, MUTED_COLOR, 0, slot_address_label); reset_vector = (VoidFunction**)(slot_address + 0x4); u32_to_hex( (u32)*reset_vector, &slot_address_label[2]); __Display_Str( (left + FONT_WIDTH * 14), bottom, color, 0, slot_address_label); } }
void static render() { // The display consists of: // + The slot index // + The address of the slot // + The address of the Reset_Handler for that slot ( helps to identify if a // slot is in use) char text[8+1]; u32 slot_address; VoidFunction **reset_vector; slot_address = FIRST_SLOT + SLOT_SIZE * slot_cursor; reset_vector = (VoidFunction**)(slot_address + 0x4); text[ 0] = '0'+ slot_cursor / 10; text[ 1] = '0'+ slot_cursor % 10; text[ 2] = '\0'; __Display_Str( VALUE_LEFT, BOTTOM+FONT_HEIGHT*2, VALUE_COLOR, 0, text); u32_to_hex( slot_address, text); text[ 8] = '\0'; __Display_Str( VALUE_LEFT, BOTTOM+FONT_HEIGHT*1, VALUE_COLOR, 0, text); u32_to_hex( (u32)*reset_vector, text); text[ 8] = '\0'; __Display_Str( VALUE_LEFT, BOTTOM+FONT_HEIGHT*0, VALUE_COLOR, 0, text); }
void static render() { int x = 0; int y = SCREEN_HEIGHT - FONT_HEIGHT; char msg[] = "VAL:0x12345678"; u32_to_hex( SysTick->VAL, &msg[6]); __Display_Str( x, y, WHITE, 0, msg); y -= FONT_HEIGHT; char m[] = "reloads:0x12345678"; u32_to_hex( systick_reloads, &m[10]); __Display_Str( x, y, WHITE, 0, m); }
int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) { const u32 *digest = (const u32 *) digest_buf; // we can not change anything in the original buffer, otherwise destroying sorting // therefore create some local buffer u32 tmp[5]; tmp[0] = digest[0]; tmp[1] = digest[1]; tmp[2] = digest[2]; tmp[3] = digest[3]; tmp[4] = digest[4]; if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) { tmp[0] += SHA1M_A; tmp[1] += SHA1M_B; tmp[2] += SHA1M_C; tmp[3] += SHA1M_D; tmp[4] += SHA1M_E; } tmp[0] = byte_swap_32 (tmp[0]); tmp[1] = byte_swap_32 (tmp[1]); tmp[2] = byte_swap_32 (tmp[2]); tmp[3] = byte_swap_32 (tmp[3]); tmp[4] = byte_swap_32 (tmp[4]); u8 *out_buf = (u8 *) line_buf; int out_len = 0; u32_to_hex (tmp[0], out_buf + out_len); out_len += 8; u32_to_hex (tmp[1], out_buf + out_len); out_len += 8; u32_to_hex (tmp[2], out_buf + out_len); out_len += 8; u32_to_hex (tmp[3], out_buf + out_len); out_len += 8; u32_to_hex (tmp[4], out_buf + out_len); out_len += 8; out_buf[out_len] = hashconfig->separator; out_len += 1; out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len); return out_len; }
bool STF_DDS::dds::setPhase(which_channel channel, uInt32 phase, Int64 time) { if (channel != currentChannel) { setChannel(channel, time-operationTime); } int address = 0x00 & 0x05; addressList.push_back(address); phase = phase << 16; // register is only 16 bits wide & always start with MSB first. std::string phase_string = u32_to_hex(phase); std::cerr << "this is the command in hex: " << phase_string << std::endl; std::cerr << "this is the command in decimal: " << phase << std::endl; commandList.push_back(phase); if(!setTime(time)) std::cerr << "failed to set phase" << std::endl; else std::cerr << "Set phase" << std::endl; return true; }
bool STF_DDS::dds::setAmplitude(which_channel channel, uInt32 amplitude, Int64 time) { if (channel != currentChannel) { setChannel(channel, time-operationTime); } int address = 0x00 & 0x06; addressList.push_back(address); // set manual amplitude mode, if not already set uInt32 command = (0x1000 | amplitude); std::string command_str = u32_to_hex(command); std::cerr << "this is the command in hex: " << command_str << std::endl; std::cerr << "this is the command in decimal: " << command << std::endl; commandList.push_back(command); if(!setTime(time)) std::cerr << "failed to set amplitude" << std::endl; else std::cerr << "Set amplitude" << std::endl; return true; }
int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) { const odf12_t *odf12 = (const odf12_t *) esalt_buf; int out_len = snprintf (line_buf, line_size, "%s*1*1*%d*32*%08x%08x%08x%08x%08x%08x%08x%08x*16*%08x%08x%08x%08x*16*%08x%08x%08x%08x*0*", SIGNATURE_ODF, odf12->iterations, byte_swap_32 (odf12->checksum[0]), byte_swap_32 (odf12->checksum[1]), byte_swap_32 (odf12->checksum[2]), byte_swap_32 (odf12->checksum[3]), byte_swap_32 (odf12->checksum[4]), byte_swap_32 (odf12->checksum[5]), byte_swap_32 (odf12->checksum[6]), byte_swap_32 (odf12->checksum[7]), byte_swap_32 (odf12->iv[0]), byte_swap_32 (odf12->iv[1]), byte_swap_32 (odf12->iv[2]), byte_swap_32 (odf12->iv[3]), byte_swap_32 (salt->salt_buf[0]), byte_swap_32 (salt->salt_buf[1]), byte_swap_32 (salt->salt_buf[2]), byte_swap_32 (salt->salt_buf[3])); u8 *out_buf = (u8 *) line_buf; for (int i = 0; i < 256; i++) { u32_to_hex (odf12->encrypted_data[i], out_buf + out_len); out_len += 8; } return out_len; }
int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) { const u32 *digest = (const u32 *) digest_buf; // we can not change anything in the original buffer, otherwise destroying sorting // therefore create some local buffer u32 tmp[8]; tmp[0] = digest[0]; tmp[1] = digest[1]; tmp[2] = digest[2]; tmp[3] = digest[3]; tmp[4] = digest[4]; tmp[5] = digest[5]; tmp[6] = digest[6]; tmp[7] = digest[7]; if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) { tmp[0] += SHA256M_A; tmp[1] += SHA256M_B; tmp[2] += SHA256M_C; tmp[3] += SHA256M_D; tmp[4] += SHA256M_E; tmp[5] += SHA256M_F; tmp[6] += SHA256M_G; tmp[7] += SHA256M_H; } tmp[0] = byte_swap_32 (tmp[0]); tmp[1] = byte_swap_32 (tmp[1]); tmp[2] = byte_swap_32 (tmp[2]); tmp[3] = byte_swap_32 (tmp[3]); tmp[4] = byte_swap_32 (tmp[4]); tmp[5] = byte_swap_32 (tmp[5]); tmp[6] = byte_swap_32 (tmp[6]); tmp[7] = byte_swap_32 (tmp[7]); u8 *out_buf = (u8 *) line_buf; u32_to_hex (tmp[0], out_buf + 0); u32_to_hex (tmp[1], out_buf + 8); u32_to_hex (tmp[2], out_buf + 16); u32_to_hex (tmp[3], out_buf + 24); u32_to_hex (tmp[4], out_buf + 32); u32_to_hex (tmp[5], out_buf + 40); u32_to_hex (tmp[6], out_buf + 48); u32_to_hex (tmp[7], out_buf + 56); const int out_len = 64; return out_len; }
int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) { const u32 *digest = (const u32 *) digest_buf; // we can not change anything in the original buffer, otherwise destroying sorting // therefore create some local buffer u32 tmp[8]; tmp[0] = digest[0]; tmp[1] = digest[1]; tmp[2] = digest[2]; tmp[3] = digest[3]; tmp[4] = digest[4]; tmp[5] = digest[5]; tmp[6] = digest[6]; tmp[7] = digest[7]; u8 *out_buf = (u8 *) line_buf; u32_to_hex (tmp[0], out_buf + 0); u32_to_hex (tmp[1], out_buf + 8); u32_to_hex (tmp[2], out_buf + 16); u32_to_hex (tmp[3], out_buf + 24); u32_to_hex (tmp[4], out_buf + 32); u32_to_hex (tmp[5], out_buf + 40); u32_to_hex (tmp[6], out_buf + 48); u32_to_hex (tmp[7], out_buf + 56); int out_len = 64; out_buf[out_len] = hashconfig->separator; out_len += 1; out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, (const int) salt->salt_len, out_buf + out_len); return out_len; }
bool STF_DDS::dds::setFrequency(which_channel channel, uInt32 frequency, Int64 time) { if (channel != currentChannel) { setChannel(channel, time-operationTime); } std::string command = u32_to_hex(frequency); std::cerr << "this is the frequency in hex: " << command << std::endl; std::cerr << "this is the frequency in decimal: " << frequency << std::endl; int address = 0x00 & 0x04; addressList.push_back(address); commandList.push_back(frequency); if(!setTime(time)) std::cerr << "failed to set frequency" << std::endl; else std::cerr << "Set frequency" << std::endl; return true; }
int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) { const dpapimk_t *dpapimk = (const dpapimk_t *) esalt_buf; u32 version = 2; u32 context = dpapimk->context; u32 rounds = salt->salt_iter + 1; u32 contents_len = dpapimk->contents_len; u32 SID_len = dpapimk->SID_len; u32 iv_len = 32; u8 cipher_algorithm[8] = { 0 }; u8 hash_algorithm[8] = { 0 }; u8 SID[512] = { 0 }; u8* SID_tmp; u32 *ptr_SID = (u32 *) dpapimk->SID; u32 *ptr_iv = (u32 *) dpapimk->iv; u32 *ptr_contents = (u32 *) dpapimk->contents; u32 u32_iv[4]; u8 iv[32 + 1]; // convert back SID SID_tmp = (u8 *) hcmalloc ((SID_len + 1) * sizeof(u8)); for (u32 i = 0; i < (SID_len / 4) + 1; i++) { u8 hex[8] = { 0 }; u32_to_hex (byte_swap_32 (ptr_SID[i]), hex); for (u32 j = 0, k = 0; j < 8; j += 2, k++) { SID_tmp[i * 4 + k] = hex_to_u8 (&hex[j]); } } // overwrite trailing 0x80 SID_tmp[SID_len] = 0; for (u32 i = 0, j = 0 ; j < SID_len ; i++, j += 2) { SID[i] = SID_tmp[j]; } hcfree (SID_tmp); for (u32 i = 0; i < iv_len / 8; i++) { u32_iv[i] = byte_swap_32 (ptr_iv[i]); u32_to_hex (u32_iv[i], iv + i * 8); } iv[32] = 0; u32 u32_contents[36]; u8 contents[288 + 1]; for (u32 i = 0; i < contents_len / 8; i++) { u32_contents[i] = byte_swap_32 (ptr_contents[i]); u32_to_hex (u32_contents[i], contents + i * 8); } contents[288] = 0; if (contents_len == 288) { memcpy (cipher_algorithm, "aes256", strlen ("aes256")); memcpy (hash_algorithm, "sha512", strlen ("sha512")); } const int line_len = snprintf (line_buf, line_size, "%s%d*%d*%s*%s*%s*%d*%s*%d*%s", SIGNATURE_DPAPIMK, version, context, SID, cipher_algorithm, hash_algorithm, rounds, iv, contents_len, contents); return line_len; }