입력된 값을 2진형태로 출력

입력된 값을 2진형태로 출력#include static int weight;int blockWeight(int a){ int n = 0; int mask = 1; for (n = 0; n < 32; n++) { weight = (a >> 31) & mask; a = a << 1; } return weight;}int main(int arg...

비트필드에서 Range Weight 구하기

비트필드에서 Range Weight 구하기#include float AndOrValue(int a, int b){ int n = 0; int Orflag = 0; int Andflag = 0; for (n = 0; n < 16; n++) { if ( a >> 30 && b >> 30) { Andflag++; } if (((a >> 30) ...

Triple DES library source

Triple DES library source---- 1. Triple DES library source 1. Triple DES 알고리즘의 이해를 위한 예제 및 library 1. 1. Version 0.1 1. 2006/04/15 ----미국 상무성의 국립표준국 (NBS, National Bureau os Standards) 에서공모를 통하여 채택된...

atox 함수 구현

atox 함수 구현네트웍프로그램 중 아래의 함수를 사용해야 해서 작성 한 적이 있습니다.(radius 관련)my_atox(aa, bb);int my_atox(char bis, char sib) / ascii to hex by HLIM /{ char p, b; char a; int i, sib_len, cnt; p = sib; b = bis; sib_len...

Base64 인코딩

Base64 인코딩시중에 돌아다니는 base64관련 함수를 짜집기 한겁니다. 출처는 PHP3 에 들어간 Base64 Encode & Decode Source 랍니다.목적으로 하는 문자열을 입력하면 base64로 인코딩과 디코딩을 시켜줍니다. base64는 웹에서 데이터를 전달(Content-Transfer)하기 위한 목적으로 사용됩니다. 사람이 읽을 수 ...

blowfish 알고리즘을 이용한 데이터 암호화

blowfish 알고리즘을 이용한 데이터 암호화---- 1. blowcrypt 1. blowfish 알고리즘을 이용한 데이터 암호화 1. 1. Version 0.2 1. 2004/03/30----openssh에서 제공하는 blowfish 알고리즘을 이용해서 데이터를 암호화 합니다. blowfish는 데이터의 암호화와 복호화를 위해서 동일한 키를 사용...

C코드 : 비트연산으로 홀짝 검사하기.

C코드 첫 비트가 0이면 짝수 1이면 홀수 인 것에 착안.#include int main(int argc, char argv){ char buf; while(fgets(buf, 80, stdin)!= NULL) { (atoi(buf) << 31)?printf("홀수\n") }}#include int main(int argc...

C코드 : connect 타임 아웃

C코드 int connectWithTimeout(int fd,struct sockaddr remote, int len, int secs, int err){ int saveflags,ret,back_err; fd_set fd_w; struct timeval timeout; saveflags = fcntl(fd,F_GETFL,0); if(saveflags<...

파일복사 함수

파일복사 함수유닉스 표준함수에는 파일을 복사함수를 지원하지 않는다. link(2)를 통해서 하드링크(파일 복사 함수는 단지 open(2), read(2), write(2)만 있음 될것 같지만.. 권한, 소유자등을 일치시켜줘야 하기 때문에 부가적인 몇 가지 시스템 함수들이 추가된다. int copy(const char src, const char dst);...

시간을 문자열로 출력하기

시간을 문자열로 출력하기 시간날짜등을 포맷팅한다.포맷스트링은 이곳을 참조한다.http예제를 실행했을시 지원되는 포맷을 확인할수 있다.#include #include #include char mon_full = { "January", "February", "March", "April", "May", "Ju...