void aes256_decrypt(const aes_secret& key, aes_block& block) { aes256_context context; aes256_init(&context, key.data()); aes256_decrypt_ecb(&context, block.data()); aes256_done(&context); }
// ------------------------------------------------------------------------------------------------ bool AES256::Init(CSStr key) { // Clear current key, if any aes256_done(&m_Context); // Is the specified key empty? if (!key || *key == '\0') { return false; // Leave the context with an empty key } // Obtain the specified key size const Uint32 size = (std::strlen(key) * sizeof(SQChar)); // See if the key size is accepted if (size > sizeof(m_Buffer)) { STHROWF("The specified key is out of bounds: %u > %u", size, sizeof(m_Buffer)); } // Initialize the key buffer to 0 std::memset(m_Buffer, 0, sizeof(m_Buffer)); // Copy the key into the key buffer std::memcpy(m_Buffer, key, size); // Initialize the context with the specified key aes256_init(&m_Context, m_Buffer); // This context was successfully initialized return true; }
int id_init(int handle, const id_desc_t *desc, mifare_tag_t *tag, const void *id, int32_t counter) { int i, block = desc->sector * 4; /* Generate per card key */ uint8_t aes_key[32]; memcpy(aes_key, desc->aes_key, 32); for (i = 0; i < 32; i++) aes_key[i] ^= tag->serial[i & 3]; /* Prepare buffer */ uint8_t buf[16]; memcpy(buf, desc->magic, 4); memcpy(&buf[4], id, 12); /* Encrypt buffer */ aes256_context aes; aes256_init(&aes, aes_key); aes256_encrypt_ecb(&aes, buf); aes256_done(&aes); if (mifare_select(handle, tag)) return ID_ERROR_SELECT; if (mifare_login(handle, desc->sector, desc->key_type, desc->key)) return ID_ERROR_LOGIN; if (mifare_write_block(handle, block + 1, buf)) return ID_ERROR_WRITE_BLOCK; if (mifare_write_value(handle, block + 2, 0)) return ID_ERROR_WRITE_VALUE; return ID_OK; }
int main (int argc, char *argv[]) { aes256_context ctx; uint8_t key[32]; uint8_t buf[16], i; /* put a test vector */ //for (i = 0; i < sizeof(buf);i++) buf[i] = i * 16 + i; /*for (i = 0; i < sizeof(buf);i++)*/ strcpy(buf, "plain text to cipher"); for (i = 0; i < sizeof(key);i++) key[i] = i; DUMP("txt: ", i, buf, sizeof(buf)); DUMP("key: ", i, key, sizeof(key)); printf("---\n"); aes256_init(&ctx, key); aes256_encrypt_ecb(&ctx, buf); DUMP("enc: ", i, buf, sizeof(buf)); //printf("tst: 8e a2 b7 ca 51 67 45 bf ea fc 49 90 4b 49 60 89\n"); //aes256_init(&ctx, key); //aes256_init(&ctx, key); aes256_decrypt_ecb(&ctx, buf); DUMP("dec: ", i, buf, sizeof(buf)); aes256_done(&ctx); return 0; } /* main */
int main(void) { aes256_context ctx; uint8_t key[32]; uint8_t buf[16], i; /* Put a test vector. */ for (i = 0; i < sizeof(buf); i++) buf[i] = i * 16 + i; for (i = 0; i < sizeof(key); i++) key[i] = i; DUMP("txt: ", i, buf, sizeof(buf)); DUMP("key: ", i, key, sizeof(key)); printf("---\n"); aes256_init(&ctx, key); aes256_encrypt_ecb(&ctx, buf); DUMP("enc: ", i, buf, sizeof(buf)); printf("tst: 8e a2 b7 ca 51 67 45 bf ea fc 49 90 4b 49 60 89\n"); aes256_init(&ctx, key); aes256_decrypt_ecb(&ctx, buf); DUMP("dec: ", i, buf, sizeof(buf)); aes256_done(&ctx); return (0); }
void FileAccessEncrypted::close() { if (!file) return; if (writing) { Vector<uint8_t> compressed; size_t len = data.size(); if (len % 16) { len+=16-(len % 16); } MD5_CTX md5; MD5Init(&md5); MD5Update(&md5,data.ptr(),data.size()); MD5Final(&md5); compressed.resize(len); zeromem( compressed.ptr(), len ); for(int i=0;i<data.size();i++) { compressed[i]=data[i]; } aes256_context ctx; aes256_init(&ctx,key.ptr()); for(size_t i=0;i<len;i+=16) { aes256_encrypt_ecb(&ctx,&compressed[i]); } aes256_done(&ctx); file->store_32(COMP_MAGIC); file->store_32(mode); file->store_buffer(md5.digest,16); file->store_64(data.size()); file->store_buffer(compressed.ptr(),compressed.size()); file->close(); memdelete(file); file=NULL; data.clear(); } else { file->close(); memdelete(file); data.clear(); file=NULL; } }
int main (int argc, char *argv[]) { aes256_context ctx; FILE *in_file; long fileSize; FILE *out_file; uint8_t key[32]; uint8_t i; uint8_t fileBuf[16]; uint8_t *tmpBuf; time_t start, end; float gap; in_file = fopen(ENCODED_FILE_NAME, "rb"); out_file = fopen(DECODED_FILE_NAME, "wb"); if(in_file == NULL) exit(1); fseek(in_file, 0, SEEK_END); fileSize = ftell(in_file); rewind(in_file); //get a test key for (i = 0; i < sizeof(key);i++) key[i] = i; start = clock(); while( fread(fileBuf, 1, sizeof(fileBuf), in_file) ) { aes256_init(&ctx, key); aes256_decrypt_ecb(&ctx, fileBuf); fwrite(fileBuf, 1, sizeof(fileBuf), out_file); fileSize -= sizeof(fileBuf); if(0 < fileSize && fileSize < sizeof(fileBuf)) { tmpBuf = (uint8_t *)malloc(sizeof(uint8_t)*fileSize); fread(tmpBuf, 1, fileSize, in_file); aes256_init(&ctx, key); aes256_decrypt_ecb(&ctx, tmpBuf); fwrite(tmpBuf, 1, fileSize, out_file); break; } } aes256_done(&ctx); end = clock(); gap = (float) (end - start)/CLOCKS_PER_SEC; printf("걸린시간 : %f초", gap); fclose(in_file); fclose(out_file); return 0; }
int main(int argc, char *argv[]) { aes256_context ctx; uint8_t k[32], v[16], x[24]; char key[45], msg[33]; int key_len, msg_len; unsigned int i; if (argc != 3) { printf("Uso: descifraping clave mensaje\n"); return 1; } memset(k, 0, sizeof(k)); memset(v, 0, sizeof(v)); memset(x, 0, sizeof(x)); memset(key, 'A', sizeof(key)); memset(msg, 'A', sizeof(msg)); key_len = strlen(argv[1]); msg_len = strlen(argv[2]); key_len = (key_len>44) ? 44 : key_len; msg_len = (msg_len>32) ? 32 : msg_len; strncpy(key+(44-key_len), argv[1], (key_len)); strncpy(msg+(32-msg_len), argv[2], (msg_len)); key[44]='\0'; msg[32]='\0'; printf("String clave (base64): %s\n", key); printf("String mensaje.......: %s\n", msg); base64_to_buf_r(k, (unsigned char *) key); base64_to_buf_r(x, (unsigned char *) msg); memcpy(k+24,x,8); memcpy(v,x+8,16); DUMP("CLAVE....: ", i, k, sizeof(k)); DUMP("ENTRADA..: ", i, x, sizeof(x)); DUMP("ENCRIPT..: ", i, v, sizeof(v)); aes256_init(&ctx, k); aes256_decrypt_ecb(&ctx, v); aes256_done(&ctx); DUMP("DESCRIPT.: ", i, v, sizeof(v)); printf("Resultado: %s\n\n", v); exit(EXIT_SUCCESS); }
int id_read(int handle, const id_desc_t *desc, mifare_tag_t *tag, void *id, int32_t *counter) { int i, block = desc->sector * 4; /* Generate per card key */ uint8_t aes_key[32]; memcpy(aes_key, desc->aes_key, 32); for (i = 0; i < 32; i++) aes_key[i] ^= tag->serial[i & 3]; uint8_t buf[16]; if (mifare_select(handle, tag)) return ID_ERROR_SELECT; if (mifare_login(handle, desc->sector, desc->key_type, desc->key)) return ID_ERROR_LOGIN; if (mifare_read_block(handle, block + 1, buf)) return ID_ERROR_READ_BLOCK; /* Decrypt block */ aes256_context ctx; aes256_init(&ctx, aes_key); aes256_decrypt_ecb(&ctx, buf); aes256_done(&ctx); if (memcmp(buf, desc->magic, 4) != 0) return ID_ERROR_INVALID_MAGIC; if (mifare_dec_value(handle, block + 2, 1)) return ID_ERROR_DEC_VALUE; if (mifare_read_value(handle, block + 2, counter)) return ID_ERROR_READ_VALUE; memcpy(id, &buf[4], 12); return ID_OK; }
PUBLIC void script_data_destroy(ScriptData *script) { aes256_done(&script->ctx); FREE(script); return; }
int main (UNUSED_ int argc, UNUSED_ char *argv[]) { uint8_t key[32] = { 0xFF, 0x7A, 0x61, 0x7C, 0xE6, 0x91, 0x48, 0xE4, 0xF1, 0x72, 0x6E, 0x2F, 0x43, 0x58, 0x1D, 0xE2, 0xAA, 0x62, 0xD9, 0xF8, 0x05, 0x53, 0x2E, 0xDF, 0xF1, 0xEE, 0xD6, 0x87, 0xFB, 0x54, 0x15, 0x3D }; uint8_t buf[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x22, 0x23 }; rfc3686_blk ctr = { {0x00, 0x1C, 0xC5, 0xB7}, /* nonce */ {0x51, 0xA5, 0x1D, 0x70, 0xA1, 0xC1, 0x11, 0x48}, /* IV */ {0x00, 0x00, 0x00, 0x01} /* counter */ }; aes256_context ctx; int rc; uint8_t i; /* ********************************************************** * First we test CTR */ printf("# CTR test\n"); dump("Text:", buf, sizeof(buf)); dump("Key:", key, sizeof(key)); aes256_init(&ctx, key); aes256_setCtrBlk(&ctx, &ctr); aes256_encrypt_ctr(&ctx, buf, sizeof(buf)); dump("Result:", buf, sizeof(buf)); rc = mem_isequal(buf, RFC3686_TV9, sizeof(RFC3686_TV9)); printf("\t^ %s\n", (rc == 0) ? "Ok" : "INVALID" ); /* reset the counter to decrypt */ ctr.ctr[0] = ctr.ctr[1] = ctr.ctr[2] = 0; ctr.ctr[3] = 1; aes256_setCtrBlk(&ctx, &ctr); aes256_decrypt_ctr(&ctx, buf, sizeof(buf)); dump("Text:", buf, sizeof(buf)); /* ************************************************************ * Now we test the core AES-256 ECB, just in case */ printf("\n# ECB test\n"); for (i = 0; i < sizeof(AES256_TV); i++) buf[i] = ((i << 4) & 0xF0) + i; for (i = 0; i < sizeof(key); i++) key[i] = i; dump("Text:", buf, sizeof(AES256_TV)); dump("Key:", key, sizeof(key)); aes256_init(&ctx, key); aes256_encrypt_ecb(&ctx, buf); dump("Result:", buf, sizeof(AES256_TV)); rc = mem_isequal(buf, AES256_TV, sizeof(AES256_TV)); printf("\t^ %s\n", (rc == 0) ? "Ok" : "INVALID" ); aes256_done(&ctx); return 0; } /* main */
// ------------------------------------------------------------------------------------------------ void AES256::Done() { aes256_done(&m_Context); }
// ------------------------------------------------------------------------------------------------ AES256::AES256() : m_Context(), m_Buffer() { aes256_done(&m_Context); }
void *decryptor() { unsigned char buff_aes1[16]; unsigned char buff_aes2[16]; unsigned char buff_aes3[16]; unsigned char buff_aes4[16]; unsigned char buff_aes5[16]; unsigned char buff_aes6[16]; unsigned char buff_aes7[16]; unsigned char buff_aes8[16]; unsigned char buff_aes9[16]; unsigned char buff_aes10[16]; unsigned char buff_aes11[16]; unsigned char aes_dec[176], w_char1, w_char2, w_char3, w_char4; int temp, temp2; int index = 0, b; unsigned int filter = 32768,temp_r[9], temp_36extra[9]= {0}; int s=0; int j =0; unsigned char key[32]; int count_filewrite = 0; char out_name1[80] = "out1.bit"; char out_name2[80] = "out2.bit"; FILE *fp; unsigned char local_h2_buffer[176]; int count = 0; DWORD byteswritten = 0, bytesread = 0; aes256_context ctx; unsigned char i; fp = fopen(out_name1, "wb"); for (i = 0; i < sizeof(key); i++) key[i] = i; while(1) { sem_wait(&decryptor_start); memcpy(local_h2_buffer,h2_buffer,176); sem_post(&reciever_start); for(j=0; j<sizeof(buff_aes1); j++) { buff_aes1[j] = local_h2_buffer[j]; buff_aes2[j] = local_h2_buffer[j+16]; buff_aes3[j] = local_h2_buffer[j+32]; buff_aes4[j] = local_h2_buffer[j+48]; buff_aes5[j] = local_h2_buffer[j+64]; buff_aes6[j] = local_h2_buffer[j+80]; buff_aes7[j] = local_h2_buffer[j+96]; buff_aes8[j] = local_h2_buffer[j+112]; buff_aes9[j] = local_h2_buffer[j+128]; buff_aes10[j] = local_h2_buffer[j+144]; buff_aes11[j] = local_h2_buffer[j+160]; } aes256_init(&ctx, key); aes256_decrypt_ecb(&ctx, buff_aes1); aes256_decrypt_ecb(&ctx, buff_aes2); aes256_decrypt_ecb(&ctx, buff_aes3); aes256_decrypt_ecb(&ctx, buff_aes4); aes256_decrypt_ecb(&ctx, buff_aes5); aes256_decrypt_ecb(&ctx, buff_aes6); aes256_decrypt_ecb(&ctx, buff_aes7); aes256_decrypt_ecb(&ctx, buff_aes8); aes256_decrypt_ecb(&ctx, buff_aes9); aes256_decrypt_ecb(&ctx, buff_aes10); aes256_decrypt_ecb(&ctx, buff_aes11); aes256_done(&ctx); for(j=0; j<sizeof(buff_aes1); j++) { local_h2_buffer[j] = buff_aes1[j]; local_h2_buffer[j+16] = buff_aes2[j]; local_h2_buffer[j+32] = buff_aes3[j]; local_h2_buffer[j+48] = buff_aes4[j]; local_h2_buffer[j+64] = buff_aes5[j]; local_h2_buffer[j+80] = buff_aes6[j]; local_h2_buffer[j+96] = buff_aes7[j]; local_h2_buffer[j+112] = buff_aes8[j]; local_h2_buffer[j+128] = buff_aes9[j]; local_h2_buffer[j+144] = buff_aes10[j]; local_h2_buffer[j+160] = buff_aes11[j]; } fwrite((void *)local_h2_buffer,sizeof(char),176,fp); fwrite((void *)temp_36extra,sizeof(int),9,fp); count_filewrite = count_filewrite + 1; fclose(fp); sem_post(&melp_start); if (count_filewrite%2 == 1) fp = fopen(out_name2, "wb"); else fp = fopen(out_name1, "wb"); } pthread_exit(NULL); }
Error FileAccessEncrypted::open_and_parse(FileAccess *p_base,const Vector<uint8_t>& p_key,Mode p_mode) { print_line("open and parse!"); ERR_FAIL_COND_V(file!=NULL,ERR_ALREADY_IN_USE); ERR_FAIL_COND_V(p_key.size()!=32,ERR_INVALID_PARAMETER); pos=0; eofed=false; if (p_mode==MODE_WRITE_AES256) { data.clear(); writing=true; file=p_base; mode=p_mode; key=p_key; } else if (p_mode==MODE_READ) { writing=false; key=p_key; uint32_t magic = p_base->get_32(); print_line("MAGIC: "+itos(magic)); ERR_FAIL_COND_V(magic!=COMP_MAGIC,ERR_FILE_UNRECOGNIZED); mode=Mode(p_base->get_32()); ERR_FAIL_INDEX_V(mode,MODE_MAX,ERR_FILE_CORRUPT); ERR_FAIL_COND_V(mode==0,ERR_FILE_CORRUPT); print_line("MODE: "+itos(mode)); unsigned char md5d[16]; p_base->get_buffer(md5d,16); length=p_base->get_64(); base=p_base->get_pos(); ERR_FAIL_COND_V(p_base->get_len() < base+length, ERR_FILE_CORRUPT ); int ds = length; if (ds % 16) { ds+=16-(ds % 16); } data.resize(ds); int blen = p_base->get_buffer(data.ptr(),ds); ERR_FAIL_COND_V(blen!=ds,ERR_FILE_CORRUPT); aes256_context ctx; aes256_init(&ctx,key.ptr()); for(size_t i=0;i<ds;i+=16) { aes256_decrypt_ecb(&ctx,&data[i]); } aes256_done(&ctx); data.resize(length); MD5_CTX md5; MD5Init(&md5); MD5Update(&md5,data.ptr(),data.size()); MD5Final(&md5); ERR_FAIL_COND_V(String::md5(md5.digest)!=String::md5(md5d),ERR_FILE_CORRUPT) ; file=p_base; } return OK; }
void aes_transmitter (unsigned char bytes_to_send[], int bytes_size, HANDLE h1) { int j; int temp1 = 16; int tempp1 = 16; unsigned char buff_aes1[16]; unsigned char buff_aes2[16]; unsigned char buff_aes3[16]; unsigned char buff_aes4[16]; unsigned char buff_aes5[16]; unsigned char buff_aes6[16]; unsigned char buff_aes7[16]; unsigned char buff_aes8[16]; unsigned char buff_aes9[16]; unsigned char buff_aes10[16]; unsigned char buff_aes11[16]; /*unsigned char buff_aes12[16]; unsigned char buff_aes13[16]; unsigned char buff_aes14[16]; unsigned char buff_aes15[16]; unsigned char buff_aes16[16]; unsigned char buff_aes17[16]; unsigned char buff_aes18[16]; unsigned char buff_aes19[16]; unsigned char buff_aes20[16]; unsigned char buff_aes21[16]; unsigned char buff_aes22[16]; unsigned char buff_aes23[16]; unsigned char buff_aes24[16]; unsigned char buff_aes25[16]; unsigned char buff_aes26[16]; unsigned char buff_aes27[16];*/ unsigned char buff_enc[176]; aes256_context ctx; uint8_t key[32]; uint8_t i; //HANDLE h1; //char c1[] = {"COM3"}; int first_time; int temp, mytime, second_time; clock_t t1, t2, t; t1 = clock(); first_time = time(NULL); for(j=0;j<sizeof(buff_aes1);j++) { buff_aes1[j] = bytes_to_send[j]; buff_aes2[j] = bytes_to_send[j+16]; buff_aes3[j] = bytes_to_send[j+32]; buff_aes4[j] = bytes_to_send[j+48]; buff_aes5[j] = bytes_to_send[j+64]; buff_aes6[j] = bytes_to_send[j+80]; buff_aes7[j] = bytes_to_send[j+96]; buff_aes8[j] = bytes_to_send[j+112]; buff_aes9[j] = bytes_to_send[j+128]; buff_aes10[j] = bytes_to_send[j+144]; buff_aes11[j] = bytes_to_send[j+160]; /*buff_aes12[j] = bytes_to_send[j+176]; buff_aes13[j] = bytes_to_send[j+192]; buff_aes14[j] = bytes_to_send[j+208]; buff_aes15[j] = bytes_to_send[j+224]; buff_aes16[j] = bytes_to_send[j+240]; buff_aes17[j] = bytes_to_send[j+256]; buff_aes18[j] = bytes_to_send[j+272]; buff_aes19[j] = bytes_to_send[j+288]; buff_aes20[j] = bytes_to_send[j+304]; buff_aes21[j] = bytes_to_send[j+320]; buff_aes22[j] = bytes_to_send[j+336]; buff_aes23[j] = bytes_to_send[j+352]; buff_aes24[j] = bytes_to_send[j+368]; buff_aes25[j] = bytes_to_send[j+384]; buff_aes26[j] = bytes_to_send[j+400]; buff_aes27[j] = bytes_to_send[j+416]; temp1 = temp1 + 1;*/ } //h1 = GetSerialPort(c1); if (h1 == INVALID_HANDLE_VALUE) { fprintf(stderr, "Error opening serial port\n"); exit(1); } else {} //printf("serial port opened successfully\n"); /* put a test vector */ for (i = 0; i < sizeof(key);i++) key[i] = i; // DUMP("plain txt: ", i, bytes_to_send, bytes_size); // printf("---\n"); aes256_init(&ctx, key); aes256_encrypt_ecb(&ctx, buff_aes1); aes256_encrypt_ecb(&ctx, buff_aes2); aes256_encrypt_ecb(&ctx, buff_aes3); aes256_encrypt_ecb(&ctx, buff_aes4); aes256_encrypt_ecb(&ctx, buff_aes5); aes256_encrypt_ecb(&ctx, buff_aes6); aes256_encrypt_ecb(&ctx, buff_aes7); aes256_encrypt_ecb(&ctx, buff_aes8); aes256_encrypt_ecb(&ctx, buff_aes9); aes256_encrypt_ecb(&ctx, buff_aes10); aes256_encrypt_ecb(&ctx, buff_aes11); /*aes256_encrypt_ecb(&ctx, buff_aes12); aes256_encrypt_ecb(&ctx, buff_aes13); aes256_encrypt_ecb(&ctx, buff_aes14); aes256_encrypt_ecb(&ctx, buff_aes15); aes256_encrypt_ecb(&ctx, buff_aes16); aes256_encrypt_ecb(&ctx, buff_aes17); aes256_encrypt_ecb(&ctx, buff_aes18); aes256_encrypt_ecb(&ctx, buff_aes19); aes256_encrypt_ecb(&ctx, buff_aes20); aes256_encrypt_ecb(&ctx, buff_aes21); aes256_encrypt_ecb(&ctx, buff_aes22); aes256_encrypt_ecb(&ctx, buff_aes23); aes256_encrypt_ecb(&ctx, buff_aes24); aes256_encrypt_ecb(&ctx, buff_aes25); aes256_encrypt_ecb(&ctx, buff_aes26); aes256_encrypt_ecb(&ctx, buff_aes27);*/ //DUMP("encrypted text: ", i, bytes_to_send, bytes_size); aes256_done(&ctx); //delay(); for(j=0;j<sizeof(buff_aes1);j++) { buff_enc[j] = buff_aes1[j]; buff_enc[j+16] = buff_aes2[j]; buff_enc[j+32] = buff_aes3[j]; buff_enc[j+48] = buff_aes4[j]; buff_enc[j+64] = buff_aes5[j]; buff_enc[j+80] = buff_aes6[j]; buff_enc[j+96] = buff_aes7[j]; buff_enc[j+112] = buff_aes8[j]; buff_enc[j+128] = buff_aes9[j]; buff_enc[j+144] = buff_aes10[j]; buff_enc[j+160] = buff_aes11[j]; /*buff_enc[j+176] = buff_aes12[j]; buff_enc[j+192] = buff_aes13[j]; buff_enc[j+208] = buff_aes14[j]; buff_enc[j+224] = buff_aes15[j]; buff_enc[j+240] = buff_aes16[j]; buff_enc[j+256] = buff_aes17[j]; buff_enc[j+272] = buff_aes18[j]; buff_enc[j+288] = buff_aes19[j]; buff_enc[j+304] = buff_aes20[j]; buff_enc[j+320] = buff_aes21[j]; buff_enc[j+336] = buff_aes22[j]; buff_enc[j+352] = buff_aes23[j]; buff_enc[j+368] = buff_aes24[j]; buff_enc[j+384] = buff_aes25[j]; buff_enc[j+400] = buff_aes26[j]; buff_enc[j+416] = buff_aes27[j]; tempp1 = tempp1 + 1;*/ } ser_comm(buff_enc, h1); //ser_comm(bytes_to_send, h1); //printf("\n"); t2 = clock(); second_time = time(NULL); t = t2 - t1; mytime = second_time - first_time; // printf ("Total execution time %f seconds.\n",((float)t)/CLOCKS_PER_SEC); // printf ("Program took me %d cycles to execute.\n",t); // printf("Actual time taken is %d seconds.\n", mytime); } /* main */