1. 

/**
* Angewandte Mathematik, SS09, IFB 2C
* ACM Problem #128 Software CRC
* Link: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=3&problem=64&mosmsg=Submission+received+with+ID+7152496
*
* @author Andre Wolfram
* @author Christoph Miesel
* @author Robert Seilbeck
* @version 13.0, 05/24/2009
*
* Status : Accepted
* Runtime 1.296
*/

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {


public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(
System.in));
String line;

while ((line = reader.readLine()) != null) {
if (line.equals("#")) {
break;
}
if (line.length() == 0) {
System.out.println("00 00");
} else {
long bigInt = 0;
for (int i = 0; i < line.length(); i++) {
bigInt <<= 8;
bigInt += (int) line.charAt(i);
bigInt %= 34943;
}
bigInt <<= 16;
long modResult = bigInt % 34943;
String output = Long.toHexString(34943 - modResult);
for (int i = output.length(); i < 4; i++) {
output = "0" + output;
}
output = output.toUpperCase();
System.out.println(output.substring(0, 2) + " "
+ output.substring(2, 4));
}
}
}
}

2.

/* @Problem 128 Software CRC
* Link: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=3&problem=64&mosmsg=Submission+received+with+ID+7152496
*
* @Autor Markus Stadler
* @Autor Johannes Müller

*
* Status : Accepted
* Runtime 0.492
*/

//Problem 8. Korrekte Nachrichten S. 115 aus "Algorithmen und Problemlösungen mit C++"

import java.io.*;

class SoftwareCRC {
public static void main (String[] args) throws Exception {
BufferedReader buin = new BufferedReader (new InputStreamReader (System.in));
Writer out = new BufferedWriter(new PrintWriter(System.out));

String line = buin.readLine();
long g = 34943;
while(line.compareTo("#") != 0){
int i, n;
long n1, n2;
n = line.length();
long remainder = 0;
for(i = 0; i < n; i++){
remainder <<= 8;
remainder += line.charAt(i);
remainder %= g;
}
remainder <<= 16;
remainder %= g;
if(remainder != 0)
remainder = g - remainder;
n1 = remainder >> 8;
n2 = remainder - (n1 << 8);
if(Long.toHexString(n1).length() < 2)
out.write("0");
out.write(Long.toHexString(n1).toUpperCase()+" ");
if(Long.toHexString(n2).length() < 2)
out.write("0");
out.write(Long.toHexString(n2).toUpperCase()+"\n");
line = buin.readLine();
}
out.close();
buin.close();
}
}