// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
import jonelo.jacksum.adapt.gnu.crypto.util.Util;
import jonelo.jacksum.algorithm.AbstractChecksum;
import jonelo.jacksum.algorithm.Adler32;
import jonelo.jacksum.algorithm.Adler32alt;
import jonelo.jacksum.algorithm.Cksum;
import jonelo.jacksum.algorithm.Crc16;
import jonelo.jacksum.algorithm.Crc32;
import jonelo.jacksum.algorithm.Crc64;
import jonelo.jacksum.algorithm.Edonkey;
import jonelo.jacksum.algorithm.Elf;
import jonelo.jacksum.algorithm.FCS16;
import jonelo.jacksum.algorithm.FCS32;
import jonelo.jacksum.algorithm.Sum8;
import jonelo.jacksum.algorithm.SumBSD;
import jonelo.jacksum.algorithm.SumSysV;
import jonelo.jacksum.algorithm.Xor8;

public class ChksumAlgoFinder {
    public static void main(String[] args) throws Exception {
        String input = "1221929508";
        String output = "3038";
        AbstractChecksum[] algs = { new Crc16(), new Crc32(), new Crc64(),
                                    new Sum8(), new Xor8(), new Cksum(),
                                    new Adler32(), new Adler32alt(), new Edonkey(),
                                    new FCS16(), new FCS32(), new Elf(),
                                    new SumBSD(), new SumSysV() };
        for(AbstractChecksum alg : algs) {
            alg.update(input.getBytes());
            String calc = Util.toString(alg.getByteArray());
            System.out.println(alg.getClass().getName() + " " + output + " " + calc);
        }
    }
}
