1 class uint128
2 {
3 public:
4 unsigned long long h;
5 unsigned long long l;
6
7 uint128(){h=0;l=0;}
8
9 void operator+= (unsigned long long l1)
10 {
11 unsigned long long low= this->l;
12 this->l+=l1;
13 if(this->l<low) h++;
14 }
15
16 void operator+= (uint128 l1)
17 {
18 unsigned long long low= this->l;
19 this->h+=l1.h;
20 this->l+=l1.l;
21 if(this->l<low) this->h++;
22
23 }
24
25 uint128 operator* (unsigned long long l1)
26 {
27 uint128 *ret= new uint128();
28 for(unsigned long long i=0;i<l1;++i)
29 *ret+=l1;
30 return *ret;
31 }
32
33 };
2 {
3 public:
4 unsigned long long h;
5 unsigned long long l;
6
7 uint128(){h=0;l=0;}
8
9 void operator+= (unsigned long long l1)
10 {
11 unsigned long long low= this->l;
12 this->l+=l1;
13 if(this->l<low) h++;
14 }
15
16 void operator+= (uint128 l1)
17 {
18 unsigned long long low= this->l;
19 this->h+=l1.h;
20 this->l+=l1.l;
21 if(this->l<low) this->h++;
22
23 }
24
25 uint128 operator* (unsigned long long l1)
26 {
27 uint128 *ret= new uint128();
28 for(unsigned long long i=0;i<l1;++i)
29 *ret+=l1;
30 return *ret;
31 }
32
33 };
可以用在SHA512中~