Jump to content
  • Advertisement

crazy_andy

Member
  • Content Count

    229
  • Joined

  • Last visited

Community Reputation

100 Neutral

About crazy_andy

  • Rank
    Member
  1. crazy_andy

    arbitary long integer class

    i re-downloaded gmp, and extracted. I searched the folder for gmp.h with no results :s I would get djgpp, but i highly doubt that it will make a .h file I've done some more searching and found 1 called bigint and another called muntl, but neither have nice functionality, bigint is just weird, seems more like a calculator. muntl is ok and even "nice" exept it can't cope with n = (p-1)*(q-1); something about invalid left operhand, whereas m = p*q works. And yes, as you may have guessed it is rsa im looking at. I get the maths, but having seriouse issues getting a decent way to store large ints. I can't beleive there isn't a nice "little" class consisting of 2 files a .h and a .cpp that lets me have the full functionality of an int without having to use loads of weird functions. eg bigint p,q,m,n; p = somefuncthatreturnslargeprime(); q = somefuncthatreturnslargeprime(); m = p*q; n = (p-1)*(q-1); There may be something obviouse im missing, its been a while since i have used c++, been doing a lot of php recently. Anyway, my point is, there is a hell of a lot of apps out there that implement rsa, so what do they all use? edit: I just found mapm, it looks exactly like what i want. However all the build instructions are for old compilers (1999 era). i've got djgpp and tried to build, but i get a tonne of errors (using the built in bat file which was designed for gcc 2.95). [Edited by - crazy_andy on August 24, 2006 12:34:01 PM]
  2. crazy_andy

    Lesson 6 and beyond

    download the source, they are all in there
  3. crazy_andy

    Lesson 6 and beyond

    ok, when testing it via visual studio make a folder in the projects folder (where the source is) called data and in that folder put crate.bmp when running the exe, the data folder needs to be in the same folder as the exe.
  4. crazy_andy

    arbitary long integer class

    gmp looks like what i want, but 1) its designed for unix, and i have no idea how to build it for windows. from the documentation: MS-DOS and MS Windows On an MS-DOS system DJGPP can be used to build GMP, and on an MS Windows system Cygwin, DJGPP and MINGW can be used. All three are excellent ports of GCC and the various GNU tools. i have neither of those tools, i use visual studio as my compiler. i've looked through the example code and they all include "gmp.h" which when i search for, doesn't turn up :s
  5. im looking for a c++ class that will let me define huge ints (about 1024 bits) or 250 digits. I've googled for ages, and found a few, but they tend to be huge with support for complex numbers, and number theory as well, which i don't need. Does anyone know of a small decent class that will do whats needed? or even some info about how i can code my own.
  6. crazy_andy

    yet another winsock problem

    ok, nothing is going through, so im guessing its client side. so I've looked through it, replaced it with code from a working program etc. nothing. I have no choice but to assume its my firewall, even though it says its not blocking it
  7. crazy_andy

    yet another winsock problem

    tried 14447, no luck both computers are behind the same router, networked tried that line instead, no luck got the sniffer, just about to test
  8. crazy_andy

    yet another winsock problem

    nope, no luck. still get the same error
  9. I have been using winsock for awhile now, mainly connecting to webservers. I recently coded a program to connect to my other computer on the network. I'm behind a router, and the port is forwarded. my program worked fine untill I added extra code (another thread and connection) whichh I then commented out entirely. when the server program reaches the accept line, it waits (no errors) when my other program tries to connect it fails with errir 10060 "A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. " windows firewall is off on both and have tried turning my firewall off on both. No luck. The odd thing is, if the server + client both run on either computer and connect via 127.0.0.1 or 192.168.1.3 it works fine, no problems at all. heres my c++ code server WSADATA info; if (WSAStartup(0x101,&info) != 0) { MessageBox(NULL,"ERROR 1","ERROR",MB_OK); return false; } soc = socket(AF_INET,SOCK_STREAM,IPPROTO_TCP); if (soc == INVALID_SOCKET) { MessageBox(NULL,"ERROR 2","ERROR",MB_OK); return false; } struct sockaddr_in sa; sa.sin_addr.s_addr = INADDR_ANY; sa.sin_family = AF_INET; sa.sin_port = htons(1447); if (bind(soc,(SOCKADDR*)&sa,sizeof(sa)) == SOCKET_ERROR) { MessageBox(NULL,"ERROR 3","ERROR",MB_OK); closesocket(soc); return false; } MessageBox(NULL,"binded","ERROR",MB_OK); if (listen(soc,1) == SOCKET_ERROR) { MessageBox(NULL,"ERROR 4","ERROR",MB_OK); closesocket(soc); return false; } MessageBox(NULL,"listening","ERROR",MB_OK); do { clientSoc = accept(soc,NULL,NULL); if (clientSoc == INVALID_SOCKET) { int i = WSAGetLastError(); } } while(clientSoc == INVALID_SOCKET); and client WSADATA info; if (WSAStartup(0x101,&info) != 0) { MessageBox(NULL,"Error setting up winsock","ERROR",MB_OK|MB_ICONSTOP); return false; } soc = socket(AF_INET,SOCK_STREAM,IPPROTO_TCP); if (soc == INVALID_SOCKET) { MessageBox(NULL,"Error creating socket","ERROR",MB_OK|MB_ICONSTOP); return false; } struct hostent *hp; struct sockaddr_in sa; unsigned int addr = inet_addr(IP); hp = gethostbyaddr((char*)&addr,sizeof(addr),AF_INET); if (hp == NULL) { MessageBox(NULL,"Error getting host","ERROR",MB_OK|MB_ICONSTOP); closesocket(soc); return false; } sa.sin_addr.s_addr = *((unsigned long*)hp->h_addr); sa.sin_family = AF_INET; sa.sin_port = htons(1447); if (connect(soc,(struct sockaddr*)&sa,sizeof(sa))) { int i = WSAGetLastError(); MessageBox(NULL,"Error connecting to server","ERROR",MB_OK|MB_ICONSTOP); closesocket(soc); return false; } IP is a 15 element char array memset to 0 first any help would be appreciated.
  10. crazy_andy

    new thread

    ok, I was fearing this. Is there any nice way to get around it? or is it a case of defining a struct with all the data in and passing that as a paramettter to the static function?
  11. crazy_andy

    new thread

    I have a mfc / winsock program, I wish to have the connection code in another thread. all my connection functions are in a class called Connection. when I use AfxBeginThread(conn.SetUpConnection,0); I get an error saying cannot convert parameter 1 from UINT (LPVOID) whats going on? the setupconnection functio is UINT (LPVOID). basically how do I start a function as a new thread in a different class? thanks for any responces.
  12. crazy_andy

    error getting host

    it connects, after I forwarded port 23 on my router. its not the connect thats the problem though, its the gethostbyaddt / gethostbyname functions. edit: problem solved. the ip address passed to the function was being truncated to 10 characters doh :) [Edited by - crazy_andy on November 4, 2005 7:52:32 PM]
  13. crazy_andy

    Card Game Help

    Its really up to you, It will be easier to draw each card individuyally. look in this thread for the images. There is a load of sites to get images from. http://www.gamedev.net/community/forums/topic.asp?topic_id=272386
  14. crazy_andy

    error getting host

    I have written two programs, the client and the server. when I run both on one pc and have IP being "127.0.0.1" it connect fine, and all the other stuff in my programs work. However I want to run the server on another computer connected to my router. local IP being "192.168.1.2" when I try using the same code, to connect to the other computer using both the local IP and the actual IP I get hp being NULL. and my MessageBox saying "error getting host". I have sygate firewall on both PCs, and my router firewall. I have forwarded the port to the server computer. The software firewalls are not bllocking the program afaik. The code below is part of my SetUpConnection function. Anyone got any idea what I'm doing wrong. WSADATA info; if (WSAStartup(0x101,&info) != 0) { MessageBox(NULL,"Error setting up winsock","ERROR",MB_OK|MB_ICONSTOP); return false; } soc = socket(AF_INET,SOCK_STREAM,IPPROTO_TCP); if (soc == INVALID_SOCKET) { MessageBox(NULL,"Error creating socket","ERROR",MB_OK|MB_ICONSTOP); return false; } struct hostent *hp; struct sockaddr_in sa; if (inet_addr(IP) == INADDR_NONE) { hp = gethostbyname(IP); } else { unsigned int addr = inet_addr(IP); hp = gethostbyaddr((char*)&addr,sizeof(addr),AF_INET); } if (hp == NULL) { MessageBox(NULL,"Error getting host","ERROR",MB_OK|MB_ICONSTOP); closesocket(soc); return false; }
  15. crazy_andy

    simple? problem

    Quote: That's pretty much what you're supposed to do, as far as I remember. cin >> doesn't get "just one char", but you're hitting on the right problem. I knew it was sometghing like that :p
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!