AXL RADIUS Server & RADIUS Client API

Home

Search

Prices & Ordering

Support

RADIUS Server

RADIUS Client

TACACS+ Client

Other Java Software

Company

Contact

Privacy

Disclaimer


Table of Contents

ByteIterator

CACM87 Compression

CRC32 - Cyclical Redundency Count

MersenneTwister PRNG

BoyerMoore Text Search

Tiny Encryption Algorithm - TEA & TEAV

FTP Server

Simple DBase SQL

 

ByteIterator Class

Sometimes it's handy to be able to read/write to a byte buffer as though it were a file. The ByteIterator class provides this kind of functionality - allowing seeking, reading ints, longs, etc., from a byte buffer. You can even perform a readLine() on the buffer. Also supported are static conversion classes of bytes to ints, longs, shorts, and unsigned bytes (concoctX classes). Reverse constructions also exist for decocting the same.

Here are the docs. Here's the source.

It also includes dumping bytes in hex and ASCII, as well as the Boyer-Moore search. The ByteIterator class (in particular the dump() method) uses the Ctype class.


CACM87 Arithmetic Data Compression Class

This was translated from the C code hoping to use it in the FTP server above to store the welcome message file. Since it didn't compress as well as I hoped on short files, it was an good exercise in both translation and understanding the arithmetic compression algorithm. The zip file containing the com.theorem.compression.cacm87 class.


CRC32 - 32 bit Cyclic Redundancy Check

This class calculates the CRC32 - 32 bit Cyclic Redundancy Check The check is used in numerous systems to verify the integrity of information. It's also used as a hashing function. Unlike a regular checksum, it's sensitive to the order of the characters. It produces a 32 bit (Java int). The source is here. A very good explanation of CRC's is found at www.4d.com.

There have been a number of requests for the original C version. Here's the C code. There's another version here.


Mersenne Twister Pseudo Random Number Generator

This is a Java version of the C-program for MT19937: Integer version. The RNG has a period of period 2**19937-1. My source is here.

There's another Java version here (at the bottom of its page) which is more complete. It offers multithreading and other features, However, it adds extra &'s to mask results where it should just use ">>>" shifts to perform unsigned right shifts. That and the synchronized(this and that's) should make it a little slower. Some of the synchronization is incomplete allowing for errors in assigning "mti" in nextInteger(). Assigning mti = 0 is protected while incrementing y = mt[mti++]; is not.

The documentation in the C program says

genrand() generates one pseudorandom unsigned integer (32bit)
which is uniformly distributed among 0 to 2^32-1 for each
call. sgenrand(seed) set initial values to the working area
of 624 words. (seed is any 32-bit integer except for 0).

Of course, in Java, it runs one one eighth the speed of the compiled C program and probably uses more space. More information can be found at http://www.math.keio.ac.jp/matumoto/emt.html.

Another pair of MersenneTwisters that are a drop-in subclass replacement for java.util.Random: MersenneTwister.java and MersenneTwisterFast.java . Under JDK 1.2.1 MersenneTwisterFast seems about 3 times faster than MersenneTwister. These versions are brought to you by the generous Sean Luke


Text Searching Classes

Quickly search through lots of text (or binary data) can be slow by normal brute force methods. Here we have two much quicker ways to do the job - the Boyer-Moore and Knuth-Morris-Pratt text searches.

These implementations have an unusual twist, however. Usually the algorithms assume you can place all the data you'll search in the text buffer. Nothing could be further from the truth! The twist allows you to see if there's a partial match at the end of the buffer. You can use this information to try to match a search with data in the next block read (using something like PushbackInputStream).

This is the source to the Boyer-Moore algorithm. This is the source to the Knuth-Morris-Pratt algorithm. The Boyer-Moore is considered the more efficient of the two.


Tiny Encryption Algorithm (TEA)

This algorithm is extremely quick and quite hardy considering how small it is. There are more extensive notes in the documentation. There are two sources, one for the original TEA and one for the newer variant that address some of the theoretical weakness - TEAV

The version 1.0 of TEA that was formerly published here had a benign bug whereby it emulated the C version as if it were using signed longs instead of the unsigned longs. Version 2.0 of TEA and Version 1.0 of TEAV have corrected this problem. The buggy TEA did a fine job of encryption, but wasn't compatible with the C (and other versions).

The TEA class source code may freely distributed and may be modified to suit your needs.

There is an article on attacks on TEA and other algorithms.

TEA should not be used as a hash function (each TEA key has 3 other equivalent keys and it is easy to construct collisions for TEA). See <a href="http://www.schneier.com/paper-key-schedule.pdf">paper-key-schedule.pdf</a> for details.

Here's the main TEA pageTEA page. A search for "tiny encryption algorithm" shows a wealth of information.

Here's the C source to TEA.c and TEAV.c


Simple DBase SQL

The current version is 2.03.It has a number of improvements over 2.0, including bug fixes. The major improvements concern reading DBT (DBase memo files) & FPT (Foxpro 2) files. While much of DBase's database has remained the same the memo file format has changed. You can specify which kind of DBase memo file to read. Sadly there is no easy way to determine programmatically which is which so you may have to do some experimenting using the three existing handlers - DBASE III+, DBASE IV, and FOXPRO 2.

This was written out of frustration with Lotus Approach which bombed on every effort to get it to use an ODBC database. In the end this class actually cut out the requirement for Windows and allowed the database to be kept in MySQL on a Linux machine,  accessed by Approach and by the Java software running on Linux.

SELECT, UPDATE, and INSERT supported. No joins, expressions or field to field comparisons yet. WHERE clause supports AND and OR and NOT, but not parenthesis. It's a start towards a real JDBC driver. It uses JavaCC the Java compiler compiler to parse the SQL. I had to write this when the latest MS ODBC driver decided that an UPDATE statement wasn't an update and "Blowed up real good."

Much of this API is similar to the JDBC API, making it feel more familiar to JDBC programmers. However, this is not a JDBC implementation. One major reason for writing this is simply that most products using DBase are brain dead and don't have any form of SQL access from Java or outside world programs. Some of us need to read a DBase table, at least to copy it to a real, functioning database.

Minor problem: The implementation cares not a fig for the index files and doesn't update them. This can cause problems in a DBase application when it believes the index file is correct and won't see added records. There is a method to kill associated index files so that the application might be force to recreate them If someone knows the structure of these files please let me know.

If your table names aren't accepted try placing them in quotation marks like this:

select * from '1234'

Table names that do not form proper SQL identifiers will have to be literals. A name like a1234 doesn't have to be a literal. SQL implementations can control their table names and so work well with the identifier syntax. However files may have names not acceptable to the parser - so use literals.

More information can be found about DBase formats at http://www.e-bachmann.dk/docs/xbase.htm.

Some changes have been made - like including the source for some missing .java files, a Test.java that shows it working, and a sample database with numeric, text and memo fields.

Here's the zip file. The Changes section in the Overview page is found using the 'Description' link in the Javadocs.


FTP Server Daemon

This is currently running at ftp://ftp.axlradius.com.   The original server source written by S.Tanaka is available. It doesn't have any security at all, can't handle PASV mode and so on, but it's a great starting point. The beginning of the file may look odd, but I think it used to be Japanese comments or perhaps it's just corrupted data.

Virtual directories are configurable defined as are related permissions for each virtual directory. Permission include general read and specific permissions covering read, denial, and write on a login basis. Anonymous logins may be denied (default setting) access to the server and a maximum number of anonymous logins configured.

This version of the AXL FTP Server is released under the Lesser General Public License. This allows you to use the product in commercial and non commercial applications.

FEATURES:

Source included.
Multiple virtual directories, with general and login specific permissions.
Your own welcome message.
Automatic updates itself when configuration files change. Doesn't need to be restarted.
Automatic display files on a CWD/CDUP (for example you could display a 00_index.txt file, if it exists in the directory). [Note: not all browsers will show the entire contents of a long file (Netscape 4.X, for example)]
Maximum session count can be specified
Anonymous login capability, with session count limits.
RADIUS server can provides Idle-Timeout values for individuals (Still retains manually configurable session inactivity limits)
External authorization Java class (develop your own authorization scheme)
Home Directory support - especially handy for personal www pages in home directories.
Configurable FTP ports.
Supports REST command - used to restore interrupted sessions
Supports RADIUS attributes: Port-Limit, Idle-Timeout
Support for groups, including a notation for all real logons. (V 2.6+)
Support for external control of uploads and downloads. External classes can be called before and after an upload or download. You can use this to trigger an event on an upload or download.

Latest version:

The server is distributed as ftpd.zip by FTP or ftpd.zip by HTTP. Here's a copy of the documentation. The zip file contains a JAR file, example configuration files, and the documentation.


TOP