전체 글
-
리버싱kr 이지키젠 풀이 (Reversing.kr easy keygen Solution source using Python)Reversing 2017. 8. 1. 01:15
제목 그대로 정말 쉬웠던 문제중 하나이다. 파이썬을 통해 소스를 구현하였다. 이 문제를 통해서 파이썬이 왜 빠르고 강력하다고 하는지 직접 느꼈다. it was easy like name, and i coded solution source using python.i realized why python is soo strong and fast, # 프로그램내의 키생성 알고리즘 # Key generation algorithm in program c = 'K3yg3nm3' g = [] for i in c: g.append(ord(i)) count = 1 full = '' for i in g: a = (16 * count) ^ i a = hex(a) a = a[2:] full = full + a if count ..
-
puts() 사용법 (puts() usage)C language 2017. 7. 31. 22:06
아래를 보고 puts() 함수는 주소를 전달받는다는것을 알수있다. 포인터처럼 +4 와같은 연산으로도 사용이 가능하다. #include #define DEF "I'm a string defined by #define" int main(void) { char str1[80] = "An array was initialized to me."; const char * str2 = "A pointer was initialized to me."; puts("I am a parameter passed to puts(). "); puts(DEF); puts(str1); puts(str2); puts(&str1[5]); puts(str2+4); return 0; }
-
sizeof 연산자를 사용한 배열 (array using sizeof operator)C language 2017. 7. 31. 22:04
빈 괄호가있는 배열을 초기화 할 때 컴파일러는 초기 값 목록의 항목 수를 계산하고 배열 크기의 배열을 만듭니다. size of 연산자는 데이터 유형의 크기를 바이트로 표시하므로 배열의 크기를 알기위해 이를 size of[0]으로 나누고 for 루프가 그것을 셀수있습니다. When you initialize an array with empty parentheses, the compiler counts the number of items in the initial value list and creates an array with the array size You should attention to this ” index < sizeof days / sizeof days[0] ” The sizeof opera..
-
작은 숫자 찾기(Find a smaller number)C language 2017. 7. 31. 21:59
? 를 이용하여 쉽게 사용할수있다. using '?' Can be easily used. int imin(int n,int m) { return (n < m) ? n:m; } int imin (int n, int m){ return (n < m) ? n:m;} 두번째는 함수 정의와 동시에 함수 프로토타입이다. 한줄로 더 깔끔하게 할수있다. This is a function prototype at the same time as the function definition.
-
gets() 대신에 fgets() 사용하기 (fgets() usage instead of gets())C language 2017. 7. 31. 21:56
gets() 함수는 크기르 지정하지않아 버퍼오버플로우의 위험이있으므로 fgets() 함수를 사용한다. The gets () function does not specify a size, so there is a risk of a buffer overflow, so use the fgets () function //#include //#define STLEN 14 //int main(void) //{ // char words[STLEN]; // // puts("Enter a string."); // fgets(words, STLEN, stdin); //stdin == standard input // printf("Your string two times (puts(), and then fputs()):\n")..
-
포인터를 사용한 2차원 배열 복사 (Copy two-dimensional array using pointer)C language 2017. 7. 31. 21:49
포인터를 사용한 2차원 배열 복사 (Copy two-dimensional array using pointer)여러가지 방법을 이용해 구현해보았다. I implemented it using various methods #include void copy_array (int rows, int cols, double sour[rows][cols], double tar[rows][cols]); int main(void) { int count; int count2; const int rows = 3; const int cols = 5; double source[rows][cols] = { {1,2,3,4,5}, {6,7,8,9,10}, {11,12,13,14,15} }; double target[3][5]; cop..
-
재귀함수를 이용한 2진수 변환기 (Binary converter using recursive function)C language 2017. 7. 31. 21:46
재귀 함수를 사용하는 이진 변환기 이 문장은 재귀 함수 완료 후에 사용해야합니다. 결국 로컬 변수 'r'이 역순으로 인쇄되어 이진수를 생성합니다. Binary converter using recursive function You must know this sentence is used after recursive function done. Eventually local variable ‘ r ‘ is printed backwards to produce a binary number. #include void to_binary(unsigned long n); int main(void) { unsigned long number; printf("Enter ..
-
문자열 복사? (copy string?)C language 2017. 7. 31. 21:41
아래 결과를 보면 문자열이 복사가 된것이아니라 문자열 주소가 복사가되었다.copy = mesg; 는 그 문자열을 가르키는 두번쨰 포인터를 만들었을 뿐이다. As you can see , The string was not copied, just the address of the string was copied copy = mesg; created a second pointer to the same string#include int main(void) { const char * mesg = "Hello world!"; const char * copy; copy = mesg; printf("%s\n",copy); printf("mesg = %s; &mesg = %p; value = %p\n",mesg,&mes..