Base64Encoder and Md5 Incomplete Source code
Hi,
I'm trying to complete the following source code so that I can convert to c# to test if the token produced from both languages are exactly the same:
JAVA Snapshot source:
import java.lang.*;
import java.util.*;
import java.net.*;
import java.util.Scanner;
import java.io.*;
import java.security.*;
public class clstoken {
private String strToken;
public static void main(String[] args) {
clstoken objtoken = new clstoken();
objtoken.createToken("name a","name b","name c");
}
public void createToken (String str_A, String str_B, String str_C){
String strtime = Long.toString (System.currentTimeMillis ());
this.strToken = URLEncoder.encode (str_A, "UTF-8")
+ ":"
+ URLEncoder.encode(str_B, âUTF-8â)
+ ":"
+ strtime
+ ":"
+ new Base64Encoder ().encode (
new Md5 (str_A + str_B + strtime + str_C).getDigest ());
System.out.println("Token is " + this.strToken);
}
}
If I run this 'Base64Encoder' and 'Md5' classes cannot be found. I'm not too sure if JAVA 1.6 contains these classes as I cannot find them. Can anyone help complete the source?
I'm running Windows XP Pro and JAVA 1.6.
Thanks,
P
|