From quozl at us.netrek.org Fri Sep 1 01:42:41 2006 From: quozl at us.netrek.org (James Cameron) Date: Fri, 1 Sep 2006 16:42:41 +1000 Subject: [netrek-dev] files In-Reply-To: References: Message-ID: <20060901064241.GB24521@us.netrek.org> Yes, that's correct. See the attached patch. -- James Cameron mailto:quozl at us.netrek.org http://quozl.netrek.org/ -------------- next part -------------- New patches: [document getpath quozl at us.netrek.org**20060901063830 * getpath.c: explain how it works. ] < > { hunk ./Vanilla/ntserv/getpath.c 14 #include "struct.h" #include "data.h" +/* + +getpath() initialises all the file name global variables, by +concatenating one or more directory names and a file name to make a +relative path to a file. + +The file name global variables are in data.c and data.h, but are not +initialised there. They are to be CamelCase. + +The file name macros are in defs.h. They are to begin with N_. + +When adding a new file, you must edit each of data.c, data.h, and defs.h. + +When using a file from other code, you must include "data.h", and your +main() must call getpath(). + +*/ + void getpath() { #define MAXPATH 256 hunk ./Vanilla/ntserv/getpath.c 37 char libdir[MAXPATH], sysconfdir[MAXPATH], localstatedir[MAXPATH]; + /* define the directory names */ snprintf(libdir, MAXPATH-1, "%s", LIBDIR); snprintf(sysconfdir, MAXPATH-1, "%s", SYSCONFDIR); snprintf(localstatedir, MAXPATH-1, "%s", LOCALSTATEDIR); hunk ./Vanilla/ntserv/getpath.c 42 + /* define the file names */ sprintf(Global,"%s/%s",localstatedir,N_GLOBAL); sprintf(Scores,"%s/%s",localstatedir,N_SCORES); sprintf(PlFile,"%s/%s",localstatedir,N_PLFILE); } Context: [fix army rescue on observ ghostbust, review quozl at us.netrek.org**20060830112930 * daemonII.c: review of prior change, found a path that could lead to army rescue due to status change. Fixed. ] [fix army rescue on observ ghostbust quozl at us.netrek.org**20060830105148 * daemonII.c: avoid rescuing armies for observers. ] [Addendum to multi install instructions williamb at its.caltech.edu**20060828182740 * INSTALL: forgot to mention to rerun configure M ./Vanilla/INSTALL -1 +2 ] [TAG 2006-08-29 quozl at us.netrek.org**20060829011619] Patch bundle hash: 9fbd99d5efc4ea1689fd2ad0f14e6a42dc89e0fd From netrek at gmail.com Fri Sep 1 14:25:40 2006 From: netrek at gmail.com (Zach) Date: Fri, 1 Sep 2006 15:25:40 -0400 Subject: [netrek-dev] files In-Reply-To: <20060901064241.GB24521@us.netrek.org> References: <20060901064241.GB24521@us.netrek.org> Message-ID: Thanks James. Zach From williamb at its.caltech.edu Tue Sep 5 23:08:35 2006 From: williamb at its.caltech.edu (William Balcerski) Date: Tue, 5 Sep 2006 21:08:35 -0700 (PDT) Subject: [netrek-dev] Need help with BSD compile problem Message-ID: Ok, I have Vanilla compiled on NETBSD, however there is 1 slight problem that I'd like to correct, but don't know how. The configure program has a problem locating gdbm. Relevant lines from configure printout: checking gdbm.h usability... no checking gdbm.h presence... no checking for gdbm.h... no checking for gdbm_open in -lgdbm... no I then need to make the following changes in order to get Vanilla to compile: hunk ./Vanilla/ntserv/Makefile.in 73 -LIBS = $(RSA_LIB) $(EXTRALIBS) +LIBS = $(RSA_LIB) $(EXTRALIBS) -L/usr/pkg/lib hunk ./Vanilla/ntserv/Makefile.in 75 -INCS = $(RSA_INCS) $(EXTRAINCS) -I../include +INCS = $(RSA_INCS) $(EXTRAINCS) -I../include -I/usr/pkg/include hunk ./Vanilla/ntserv/db.c 14 -#include +#include Does anyone have any idea why the configure script is not finding the gdbm.h header file in /usr/pkg/include? Thanks. Bill From williamb at its.caltech.edu Wed Sep 6 02:17:05 2006 From: williamb at its.caltech.edu (William Balcerski) Date: Wed, 6 Sep 2006 00:17:05 -0700 (PDT) Subject: [netrek-dev] My public darcs repo Message-ID: I've put up a public darcs repo (hosted by Cryo) at http://netrek.warped.us/public-server In it are all the patches I have pushed forward for integration into Vanilla. I still have a bunch of patches on my working server that aren't pushed yet (namely, Sturgeon and newbie/pret stuff). I will no longer be sending patches to the mailing list unless I feel they need review outside of the regular IRC channel inhabitants. Recent patches include an option for observer muting, an option to prevent permanently banned players from getting a slot/connecting to server, and an option for preT idling that was last seen on the guinness server (orbit homeworld while cloaked, undamaged, and no t-mode to avoid taking damage). Bill From quozl at us.netrek.org Wed Sep 6 03:19:21 2006 From: quozl at us.netrek.org (James Cameron) Date: Wed, 6 Sep 2006 18:19:21 +1000 Subject: [netrek-dev] Need help with BSD compile problem In-Reply-To: References: Message-ID: <20060906081921.GA21735@us.netrek.org> On Tue, Sep 05, 2006 at 09:08:35PM -0700, William Balcerski wrote: > Ok, I have Vanilla compiled on NETBSD, however there is 1 slight problem > that I'd like to correct, but don't know how. The configure program has > a problem locating gdbm. Relevant lines from configure printout: > checking gdbm.h usability... no > checking gdbm.h presence... no > checking for gdbm.h... no > checking for gdbm_open in -lgdbm... no This also happens on FreeBSD. It suggests your system is not configured in the way that the autoconf generated script expects to find it. Because it cannot find gdbm, compilation will fail. Your workaround has been to modify the Makefile.in and source files. Another workaround is to prefix the configure command with an assignment to the environment variables CFLAGS and LDFLAGS. For example: CFLAGS=-I/usr/pkg/include LDFLAGS=-L/usr/pkg/lib ./configure > hunk ./Vanilla/ntserv/Makefile.in 73 > -LIBS = $(RSA_LIB) $(EXTRALIBS) > +LIBS = $(RSA_LIB) $(EXTRALIBS) -L/usr/pkg/lib This change is not required if you assign a value to LDFLAGS as above. > hunk ./Vanilla/ntserv/Makefile.in 75 > -INCS = $(RSA_INCS) $(EXTRAINCS) -I../include > +INCS = $(RSA_INCS) $(EXTRAINCS) -I../include -I/usr/pkg/include This change is not required if you assign a value to CFLAGS as above. > hunk ./Vanilla/ntserv/db.c 14 > -#include > +#include This change is not required if either CFLAGS is assigned or if -I/usr/pkg/include is used on the previous hunk. > Does anyone have any idea why the configure script is not finding the > gdbm.h header file in /usr/pkg/include? It is probably not looking there. The AC_CHECK_LIB macro is used to find the gdbm package files. The configure script expects the system to be properly configured so that a C program containing "#include " will compile without further ado. The complete fix will be something you will have to contribute: 1. change configure.in to check alternate locations if the AC_CHECK_LIB for gdbm_open() fails, using the checks for -lmp and -lX11 as examples for how this can be done, 2. re-run autoconf after making the change, 3. verify that the tree builds clean without having to apply your patch. Loop back to step 1 if this fails, 4. verify that the build still works on Linux. -- James Cameron mailto:quozl at us.netrek.org http://quozl.netrek.org/ From darius at dons.net.au Wed Sep 6 06:13:29 2006 From: darius at dons.net.au (Daniel O'Connor) Date: Wed, 6 Sep 2006 20:43:29 +0930 Subject: [netrek-dev] Need help with BSD compile problem In-Reply-To: <20060906081921.GA21735@us.netrek.org> References: <20060906081921.GA21735@us.netrek.org> Message-ID: <200609062043.39023.darius@dons.net.au> On Wednesday 06 September 2006 17:49, James Cameron wrote: > Another workaround is to prefix the configure command with an assignment > to the environment variables CFLAGS and LDFLAGS. For example: > > CFLAGS=-I/usr/pkg/include LDFLAGS=-L/usr/pkg/lib ./configure This is "The Right Thing(tm)". The ports tree makefiles do this for all GNU configure script using ports. > The complete fix will be something you will have to contribute: > > 1. change configure.in to check alternate locations if the AC_CHECK_LIB > for gdbm_open() fails, using the checks for -lmp and -lX11 as examples > for how this can be done, > > 2. re-run autoconf after making the change, > > 3. verify that the tree builds clean without having to apply your > patch. Loop back to step 1 if this fails, > > 4. verify that the build still works on Linux. Personally I think it's not worth the bother. In FreeBSD LOCALBASE, which is normally /usr/local can be moved anywhere so I think guessing is just asking for trouble later. -- Daniel O'Connor software and network engineer for Genesis Software - http://www.gsoft.com.au "The nice thing about standards is that there are so many of them to choose from." -- Andrew Tanenbaum GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://mailman.us.netrek.org/pipermail/netrek-dev/attachments/20060906/d0bd9515/attachment.pgp From williamb at its.caltech.edu Wed Sep 6 07:11:23 2006 From: williamb at its.caltech.edu (William Balcerski) Date: Wed, 6 Sep 2006 05:11:23 -0700 (PDT) Subject: [netrek-dev] Need help with BSD compile problem In-Reply-To: <200609062043.39023.darius@dons.net.au> References: <20060906081921.GA21735@us.netrek.org> <200609062043.39023.darius@dons.net.au> Message-ID: > On Wednesday 06 September 2006 17:49, James Cameron wrote: > > Another workaround is to prefix the configure command with an assignment > > to the environment variables CFLAGS and LDFLAGS. For example: > > > > CFLAGS=-I/usr/pkg/include LDFLAGS=-L/usr/pkg/lib ./configure > > This is "The Right Thing(tm)". > > The ports tree makefiles do this for all GNU configure script using ports. > Well I tried this, however it creates a whole new set of problems. Exact command used was: env CFLAGS=-I/usr/pkg/include LDFLAGS=-L/usr/pkg/lib ./configure --prefix=/local/williamb/netrek-server/Vanilla Some of the relevant configure output: checking gdbm.h usability... yes checking gdbm.h presence... no configure: WARNING: gdbm.h: accepted by the compiler, rejected by the preprocessor! configure: WARNING: gdbm.h: proceeding with the compiler's result checking for gdbm.h... yes checking ncurses.h usability... yes checking ncurses.h presence... no configure: WARNING: ncurses.h: accepted by the compiler, rejected by the preprocessor! configure: WARNING: ncurses.h: proceeding with the compiler's result checking for ncurses.h... yes checking for gdbm_open in -lgdbm... yes Ok warnings that can't be good..but wait it gets worse, here's the result of make: touch .depend gcc -M -I/usr/pkg/include -Wall -DRSA -I../include ./ban.c ./blotpassword.c ./loadchecker.c ./mess.c ./mergescores.c ./newscores.c ./planets.c ./players.c ./scores.c ./setgalaxy.c ./showgalaxy.c ./stat.c ./trimscores.c ./watchmes.c ./fun.c ./xtkill.c ./keyman.c ./nuke.c ./metaget.c ./update.c ./convert.c ./conq_vert.c ./sortdb.c ./ntpasswd.c ./setgame.c ./setplanet.c ./setteam.c > .depend In file included from showgalaxy.c:16: /usr/include/curses.h:440:20: macro "clear" passed 1 arguments, but takes just 0 /usr/include/curses.h:441:23: macro "clrtobot" passed 1 arguments, but takes just 0 /usr/include/curses.h:442:23: macro "clrtoeol" passed 1 arguments, but takes just 0 /usr/include/curses.h:444:20: macro "delch" passed 1 arguments, but takes just 0 /usr/include/curses.h:445:23: macro "deleteln" passed 1 arguments, but takes just 0 /usr/include/curses.h:447:20: macro "erase" passed 1 arguments, but takes just 0 /usr/include/curses.h:448:20: macro "getch" passed 1 arguments, but takes just 0 /usr/include/curses.h:451:19: macro "inch" passed 1 arguments, but takes just 0 /usr/include/curses.h:457:23: macro "insertln" passed 1 arguments, but takes just 0 /usr/include/curses.h:460:22: macro "refresh" passed 1 arguments, but takes just 0 /usr/include/curses.h:463:23: macro "standend" passed 1 arguments, but takes just 0 /usr/include/curses.h:464:23: macro "standout" passed 1 arguments, but takes just 0 /usr/include/curses.h:548:23: macro "gettmode" passed 1 arguments, but takes just 0 *** Error code 1 Stop. make: stopped in /local/williamb/netrek-server/Vanilla/tools *** Error code 1 Stop. make: stopped in /local/williamb/netrek-server/Vanilla *** Error code 1 Stop. make: stopped in /local/williamb/netrek-server/Vanilla Ok, sometimes I get weird stuff on make, so I just type make again. Here's the result of the 2nd make: gcc -I/usr/pkg/include -Wall -DRSA -I../include -c showgalaxy.c *** Error code 1 Stop. make: stopped in /local/williamb/netrek-server/Vanilla/tools *** Error code 1 Stop. make: stopped in /local/williamb/netrek-server/Vanilla And 100s of lines similiar to these: /usr/pkg/include/ncurses.h:792: error: previous declaration of `wnoutrefresh' /usr/include/curses.h:676: error: conflicting types for `wprintw' /usr/pkg/include/ncurses.h:794: error: previous declaration of `wprintw' /usr/include/curses.h:677: error: conflicting types for `wredrawln' So gdbm is fixed, but now curses is broken, whatever curses is. Thoughts? Bill From darius at dons.net.au Wed Sep 6 19:18:26 2006 From: darius at dons.net.au (Daniel O'Connor) Date: Thu, 7 Sep 2006 09:48:26 +0930 Subject: [netrek-dev] Need help with BSD compile problem In-Reply-To: References: <200609062043.39023.darius@dons.net.au> Message-ID: <200609070948.27730.darius@dons.net.au> On Wednesday 06 September 2006 21:41, William Balcerski wrote: > Well I tried this, however it creates a whole new set of problems. Exact > command used was: > > env CFLAGS=-I/usr/pkg/include LDFLAGS=-L/usr/pkg/lib ./configure > --prefix=/local/williamb/netrek-server/Vanilla Sorry I did not notice the mistake before - you should use CPPFLAGS instead of CFLAGS. -- Daniel O'Connor software and network engineer for Genesis Software - http://www.gsoft.com.au "The nice thing about standards is that there are so many of them to choose from." -- Andrew Tanenbaum GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://mailman.us.netrek.org/pipermail/netrek-dev/attachments/20060907/b41e1531/attachment.pgp From williamb at its.caltech.edu Wed Sep 6 23:20:03 2006 From: williamb at its.caltech.edu (William Balcerski) Date: Wed, 6 Sep 2006 21:20:03 -0700 (PDT) Subject: [netrek-dev] Need help with BSD compile problem In-Reply-To: <200609070948.27730.darius@dons.net.au> References: <200609062043.39023.darius@dons.net.au> <200609070948.27730.darius@dons.net.au> Message-ID: On Thu, 7 Sep 2006, Daniel O'Connor wrote: > On Wednesday 06 September 2006 21:41, William Balcerski wrote: > > Well I tried this, however it creates a whole new set of problems. Exact > > command used was: > > > > env CFLAGS=-I/usr/pkg/include LDFLAGS=-L/usr/pkg/lib ./configure > > --prefix=/local/williamb/netrek-server/Vanilla > > Sorry I did not notice the mistake before - you should use CPPFLAGS instead of > CFLAGS. > Alright here is output from configure: checking gdbm.h usability... yes checking gdbm.h presence... yes checking for gdbm.h... yes checking ncurses.h usability... yes checking ncurses.h presence... yes checking for ncurses.h... yes checking for gdbm_open in -lgdbm... yes That's good. Then I do make: touch null make depend cd ntserv; make depend gcc -M -g -O2 -Wall -DRSA -I../include ./cluecheck.c ./coup.c ./data.c ./db.c ./death.c ./detonate.c ./enter.c ./findslot.c ./getentry.c ./getname.c ./salt.c ./getship.c ./input.c ./interface.c ./main.c ./orbit.c ./phaser.c ./plasma.c ./redraw.c ./reserved.c ./sintab.c ./socket.c ./genspkt.c ./smessage.c ./startrobot.c ./timecheck.c ./torp.c ./util.c ./warning.c ./ping.c ./getpath.c ./features.c ./distress.c ./transwarp.c ./gencmds.c ./ntscmds.c ./openmem.c ./feature.c ./queue.c ./slotmaint.c ./wander2.c ./sysdefaults.c ./rsa_key.c > .depend db.c:14:18: gdbm.h: No such file or directory Not so good! Any idea what's going wrong here? Bill From darius at dons.net.au Thu Sep 7 00:08:07 2006 From: darius at dons.net.au (Daniel O'Connor) Date: Thu, 7 Sep 2006 14:38:07 +0930 Subject: [netrek-dev] Need help with BSD compile problem In-Reply-To: References: <200609070948.27730.darius@dons.net.au> Message-ID: <200609071438.08437.darius@dons.net.au> On Thursday 07 September 2006 13:50, William Balcerski wrote: > > Sorry I did not notice the mistake before - you should use CPPFLAGS > > instead of CFLAGS. > > Alright here is output from configure: > checking gdbm.h usability... yes > checking gdbm.h presence... yes > checking for gdbm.h... yes > checking ncurses.h usability... yes > checking ncurses.h presence... yes > checking for ncurses.h... yes > checking for gdbm_open in -lgdbm... yes > > That's good. Then I do make: > touch null > make depend > cd ntserv; make depend > gcc -M -g -O2 -Wall -DRSA -I../include ./cluecheck.c ./coup.c ./data.c > ./db.c ./death.c ./detonate.c ./enter.c ./findslot.c ./getentry.c > ./getname.c ./salt.c ./getship.c ./input.c ./interface.c ./main.c > ./orbit.c ./phaser.c ./plasma.c ./redraw.c ./reserved.c ./sintab.c > ./socket.c ./genspkt.c ./smessage.c ./startrobot.c ./timecheck.c > ./torp.c ./util.c ./warning.c ./ping.c ./getpath.c ./features.c > ./distress.c ./transwarp.c ./gencmds.c ./ntscmds.c ./openmem.c > ./feature.c ./queue.c ./slotmaint.c ./wander2.c ./sysdefaults.c > ./rsa_key.c > .depend > db.c:14:18: gdbm.h: No such file or directory > > Not so good! Any idea what's going wrong here? Hmm, not sure.. I don't have the code handy at the moment but I am guessing the Makefile isn't getting the CFLAGS value generated by configure. -- Daniel O'Connor software and network engineer for Genesis Software - http://www.gsoft.com.au "The nice thing about standards is that there are so many of them to choose from." -- Andrew Tanenbaum GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://mailman.us.netrek.org/pipermail/netrek-dev/attachments/20060907/d7066541/attachment.pgp From quozl at us.netrek.org Sun Sep 17 02:45:27 2006 From: quozl at us.netrek.org (James Cameron) Date: Sun, 17 Sep 2006 17:45:27 +1000 Subject: [netrek-dev] netrek-server-vanilla-2.11.2 released Message-ID: <20060917074527.GA9100@us.netrek.org> netrek-server-vanilla 2.11.2 was released. http://quozl.linux.org.au/netrek/ 2e5652b9dc9f9de707c5589d1eacd15a netrek-server-vanilla-2.11.2.tar.gz Packages for i386 Debian Etch also present. Summary of changes: (from "darcs changes") - fix robotd to allow debugging using SIGINT - remove unnecessary delay in conquer test - fix tests to use shell path - fix xtkill exit status - fix robots to obey GU_GAMEOK termination - add path tools - Fix for long names with scores tools - Add README.ban - Sysdef option for admin password - Perm banned doc fix - Sysdef option for noconnect for perm bans - Fixes for observer muting - Sysdef option for preT idling - fix ghostbust no ping alive response - document getpath - fix army rescue on observ ghostbust - Addendum to multi install instructions - Robot server spam reduction - Install directions on running multiple servers - Pret enhancements part1 - cleanup, debug - Newbie enhancements part1 - cleanup, debug - Basepractice unused variable removed - fix attempt for pret hang on bsd - fix bsd socket include - fix signal build errors on bsd - remove old policy, add libnetrek and sysdef hints - Merlin responds to help - Move newbie slot control to sysdef - Sysdefault instructions correction - Increase newbie slots from 8 to 16 - Ingame admin tool fixes - Pret queue renumbering - Standardize planet locs for basepractice - add setgame wait-for-terminate command - disable ban pre-queue for observers - remove ban vote expiry by login, add ban queue - adopt sigpipe implementation for ntserv - fix fix use of unsafe functions in signal handler, robots - add sigpipe implementation - Fix so basepractice bots don't get ip blocked by duplicate sysdef option - fix use of unsafe functions in signal handler, daemon, basep - Basepractice server improvements - Addition of missing options to sample sysdef - Adding vote tag to voting command structure - Remove ability to vote if VOTING=0 - Dogfight map file fix - Ban vote duration in sample sysdef - Improved tracking of server modes - Newbie server documentation update2 - comindico whitelist removal, quozl specific - noted new bug, signal handler calls unsafe functions - initial design of checkpointing - add ban tools - add ban vote duration - add live daemon release target - fix test to correctly reproduce parade ring overlap - fix for conquer parade alignment, alternate - add test for conquer parade slot alignment bug - add planet orbit and take test scripts - Semi-critical update fix - Show geno messages for observers - Formatting fix for if statement in interface.c - Command file for PreT robots - adjust test scripts for xtkill changes - Xtkill settable kills - Xtkill bug fixes - robotd-carriage-return-added-to-death-messages.dpatch - freebsd compilation fix, missing header - avoid lies to metaserver due pre-t robots - further-fixes-to-war-decs.dpatch - continuum ghostbust diagnostics - untabify daemon main - newbie robots war declarations test - Newbie robots now declare war properly in pickup games - continuum ban vote tweaks 2006-06 - xtkill ship change fixes - newbie-observer-ports.dpatch - Chaos mode starbase enhancements - Twarp message fix - ATT and invalid ship fixes - null-terminate-mapchars-indentfix - null-terminate-mapchars - robotd-improved-army-tracking.dpatch - Cross-transwarp check - post 2.11.1 release process notes - include config.guess in make dist - include config.sub in make dist -- James Cameron mailto:quozl at us.netrek.org http://quozl.netrek.org/ -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Digital signature Url : http://mailman.us.netrek.org/pipermail/netrek-dev/attachments/20060917/ca8209cf/attachment.pgp From netrek at gmail.com Mon Sep 18 16:36:30 2006 From: netrek at gmail.com (Zach) Date: Mon, 18 Sep 2006 17:36:30 -0400 Subject: [netrek-dev] Helix Live recovery boot CD Message-ID: Thought some people on the list may find this useful: http://www.e-fense.com/helix/contents.php Zach From narcis at luky.nl Thu Sep 21 16:11:10 2006 From: narcis at luky.nl (Narcis) Date: Thu, 21 Sep 2006 23:11:10 +0200 Subject: [netrek-dev] RSA.java In-Reply-To: References: Message-ID: <6088E64E-AC2A-4BD9-8C57-23B7C2BCB0CD@luky.nl> Hi i am working a bit with the JTrek Client, but the RSA code is very optimized :-) does anyone have the original RSA.java code ? is should be okay to export it to europe by now. regards Chris From msucka0xff at programmer.net Thu Sep 28 14:36:17 2006 From: msucka0xff at programmer.net (. .) Date: Thu, 28 Sep 2006 11:36:17 -0800 Subject: [netrek-dev] RSA.java Message-ID: <20060928193617.6CE811024D@ws1-3.us4.outblaze.com> it is ok to export to eu RSA.java package JTrek.rsa; import java.math.BigInteger; public class RSA { public RSA() { } private static String swapEndian(String s) { char c[] = s.toCharArray(); StringBuffer buffer = new StringBuffer(c.length); for(int i = c.length; (i -= 2) >= 0;) { buffer.append(c[i]); buffer.append(c[i + 1]); } return buffer.toString(); } private static byte[] swapEndian(byte in[]) { byte out[] = new byte[in.length]; for(int i = 0; i < in.length; i++) out[i] = in[in.length - i - 1]; return out; } private static byte[] bigIntegerToByteArray(BigInteger value) { byte bytes[] = value.toByteArray(); if(bytes.length > 32) { byte temp[] = new byte[32]; System.arraycopy(bytes, bytes.length - 32, temp, 0, 32); bytes = temp; } else if(bytes.length < 32) { byte temp[] = new byte[32]; System.arraycopy(bytes, 0, temp, 32 - bytes.length, bytes.length); bytes = temp; } return bytes; } public static byte[] generateRSAResponse(byte data[]) { byte buffer[] = new byte[96]; byte temp[] = swapEndian(bigIntegerToByteArray(GLOBAL_KEY)); System.arraycopy(temp, 0, buffer, 0, 32); temp = swapEndian(bigIntegerToByteArray(PUBLIC_KEY)); System.arraycopy(temp, 0, buffer, 32, 32); data = swapEndian(data); BigInteger value = new BigInteger(1, data); value = value.modPow(PRIVATE_KEY, GLOBAL_KEY); temp = swapEndian(bigIntegerToByteArray(value)); System.arraycopy(temp, 0, buffer, 64, 32); System.out.println("RSA->generateRSAResponse.buffer="+buffer); return buffer; } public static final String VERSION = "RSA v2.0 CLIENT"; public static final int KEY_SIZE = 32; private static BigInteger GLOBAL_KEY = new BigInteger(swapEndian("ef5dee63d00d4b69a3bd8a09ae2bf570870200f27853a4a4e9c00c063c6077bb"), 16); private static BigInteger PUBLIC_KEY = new BigInteger(swapEndian("31cdad80215d377788ee3ccd2b4f3f72a33e67c9c7c09072403493ea846c4b97"), 16); private static BigInteger PRIVATE_KEY = new BigInteger(swapEndian("91d82c09f98c0b5b024516ab1a4eb08b8d000000000000000000000000000000"), 16); } > ----- Original Message ----- > From: Narcis > To: netrek-dev at us.netrek.org > Subject: [netrek-dev] RSA.java > Date: Thu, 21 Sep 2006 23:11:10 +0200 > > > Hi > > i am working a bit with the JTrek Client, but the RSA code is very > optimized :-) does anyone have the original RSA.java code ? is should > be okay to export it to europe by now. > > regards > > Chris > > _______________________________________________ > netrek-dev mailing list > netrek-dev at us.netrek.org > http://mailman.us.netrek.org/mailman/listinfo/netrek-dev > -- ___________________________________________________ Play 100s of games for FREE! http://games.mail.com