4/3
큰 정수 a,b 더하기c=a+b(c,a,b)a>b 로 구현!a-b: 부호가 없는 절댓값을 기본으로 구현|a|>=|b| carry a4 a3 a2 a1 a0+ b2 b1 b0---------------------c5 c4 c3 c2 c1 c0 c0=a0+b0carry=c0=2^32a1+b1>=2^32-1a1>=(2^32-1)-b1}if(carry)carry=a1>=(~b1);else carry=c1 add_new(c,a,b)+ - => sub_new(c,a,b)- + => sub_new(c,b,a)=>sub_new(c,a,b)*(-1)- - => add_new(c,a,b) * -1 a-b+ +=>sub_new(c,a,b)+ - =>add_new(c,a,b)- + =>add_new(c,a,b)*-1- - =..
2018. 4. 3.
3/27
#include #include #include "gmp.h"#include clock_t elapsed; float sec;#define START_WATCH \{\elapsed = -clock(); \}\ #define STOP_WATCH \{\elapsed += clock(); \sec = (float)elapsed / CLOCKS_PER_SEC; \}\ #define PRINT_TIME(qstr) \{\printf("\n[%s: %.5f s]\n", qstr, sec); \}\ void RSA_speed_test(int RSA_SIZE, gmp_randstate_t state) {//RSA Key Generation//공개키 : n, e//비밀키 : p,q,dmpz_t n, e, p, q, d;m..
2018. 3. 27.