Packagecom; Public classMd5test {/** * @paramargs*/ Public Static voidMain (string[] args) {System.out.println (Decrypt ("137%128%143%145%124%144%135%143%76%")); System.out.println (Encrypt ("Frontdev")); } /*** User Name decryption *@paramSsotoken String *@returnstring returns the encrypted string*/ Public Staticstring Decrypt (string ssotoken) {Try{String name=NewString (); Java.util.StringTokenizer St=NewJava.util.StringTokenizer (Ssotoken, "%"); while(St.hasmoreelements ()) {intASC = Integer.parseint ((String) st.nextelement ())-27; Name= name + (Char) ASC; } returnname; }Catch(Exception e) {e.printstacktrace (); return NULL; } } /*** User name encryption *@paramSsotoken String *@returnstring returns the encrypted string*/ Public Staticstring Encrypt (string ssotoken) {Try { byte[] _ssotoken = Ssotoken.getbytes ("Iso-8859-1"); String name=NewString (); //char[] _ssotoken = Ssotoken.tochararray (); for(inti = 0; i < _ssotoken.length; i++) { intASC =_ssotoken[i]; _ssotoken[i]= (byte) (ASC + 27); Name= name + (ASC + 27) + "%"; } returnname; }Catch(Exception e) {e.printstacktrace (); return NULL; } } }
Java string ASC Encryption decryption