Debian Codegraph @

src/test/bnetsrp3_test.cpp

raw symbols SCIP
1 /*
2 * Copyright (C) 1999,2001 Ross Combs ([email protected])
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18 #include "common/setup_before.h"cxx . . $ `<file>/src/common/setup_before.h`/
19 #include <cstdio>
20 #include <cassert>
21 #include "common/xalloc.h"cxx . . $ `<file>/src/common/xalloc.h`/
22 #include "common/util.h"cxx . . $ `<file>/src/common/util.h`/
23 #include "common/bnetsrp3.h"cxx . . $ `<file>/src/common/bnetsrp3.h`/
24 #include "common/setup_after.h"cxx . . $ `<file>/src/common/setup_after.h`/
25
26 using namespace pvpgn;
27
28 int maincxx . . $ main(b126dc7c1de90089).()
29 {
30 const unsigned char salt[] = { 0xB3, 0x46, 0x25, 0x10, 0x1D, 0xEA, 0x80, 0xB9, 0x92, 0xEB, 0x50, 0x4E, 0x84, 0x00, 0x06, 0xA1,
31 0x7E, 0x77, 0x58, 0x66, 0x73, 0x89, 0x27, 0xF7, 0x14, 0x90, 0x2D, 0xA6, 0x3F, 0xCC, 0xF8, 0x52 };
32 BnetSRP3cxx . . $ pvpgn/BnetSRP3# nls1cxx . . $ pvpgn/BnetSRP3#BnetSRP3(2fa786934fe80e24).("regen", "bogen");
33 nls1.setSaltcxx . . $ pvpgn/BnetSRP3#setSalt(29cbcaec537b00e2).(BigIntcxx . . $ pvpgn/BigInt#BigInt(a7352a5524aaaab2).(salt, 32));
34
35 BigIntcxx . . $ pvpgn/BigInt# v = nls1.getVerifiercxx . . $ pvpgn/BnetSRP3#getVerifier(386d3f2c8bc32279).();
36 BigIntcxx . . $ pvpgn/BigInt# s = nls1.getSaltcxx . . $ pvpgn/BnetSRP3#getSalt(386d3f2c8bc32279).();
37 BnetSRP3cxx . . $ pvpgn/BnetSRP3# nls2cxx . . $ pvpgn/BnetSRP3#BnetSRP3(1adce25d148ffb4c).("power", s);
38
39 //output= (char *)xmalloc(40*3+1);
40
41 //s.getData(data,32);
42 //str_to_hex(output,(const char*)data,32);
43 //std::printf("salt: %s\n",output);
44
45 //v.getData(data,32,4,false);
46 //str_to_hex(output,(const char*)data,32);
47 //std::printf("verifier: %s\n",output);
48
49 BigIntcxx . . $ pvpgn/BigInt# A = nls1.getClientSessionPublicKeycxx . . $ pvpgn/BnetSRP3#getClientSessionPublicKey(386d3f2c8bc32279).();
50 //A.getData(data,32,4,false);
51 //str_to_hex(output,(const char*)data,32);
52 //std::printf("A: %s\n",output);
53
54 BigIntcxx . . $ pvpgn/BigInt# B = nls2.getServerSessionPublicKeycxx . . $ pvpgn/BnetSRP3#getServerSessionPublicKey(3c5fe9d91d82707a).(v);
55 //B.getData(data,32,4,false);
56 //str_to_hex(output,(const char*)data,32);
57 //std::printf("B: %s\n",output);
58
59 BigIntcxx . . $ pvpgn/BigInt# K1 = nls1.getHashedClientSecretcxx . . $ pvpgn/BnetSRP3#getHashedClientSecret(59a9847b0f9ae014).(B);
60 //K1.getData(data,40,4,false);
61 //str_to_hex(output,(const char*)data,40);
62 //std::printf("K1: %s\n",output);
63
64 BigIntcxx . . $ pvpgn/BigInt# K2 = nls2.getHashedServerSecretcxx . . $ pvpgn/BnetSRP3#getHashedServerSecret(804960666f5ec39a).(A, v);
65 //K2.getData(data,40,4,false);
66 //str_to_hex(output,(const char*)data,40);
67 //std::printf("K2: %s\n",output);
68
69 assertcxx . . $ `<external>/4398592474888995393/assert.h:102:11`!(K1 == K2);
70
71 //BigInt M1 = nls2.getClientPasswordProof(A, B, K1);
72 //M1.getData(data,20,4,false);
73 //str_to_hex(output,(const char*)data,20);
74 //std::printf("M1: %s\n",output);
75
76 //BigInt M2 = nls1.getServerPasswordProof(A, M1, K2);
77 //M2.getData(data,20,4,false);
78 //str_to_hex(output,(const char*)data,20);
79 //std::printf("M2: %s\n",output);
80
81 return 0;
82 }
83