Help - output

classic Classic list List threaded Threaded
1 message Options
drfx drfx
Reply | Threaded
Open this post in threaded view
|

Help - output

Salut ,

 Va rog sa-mi acordati asistenta in rezolvarea urmatoarei probleme :

 Incerc sa inteleg cum sa generez un output , bazat pe criptare SHA1 :

public class CasaDeMarkatKeyGen
{
  public static String getSerial(String paramString)
  {
    try
    {
      MessageDigest localMessageDigest = MessageDigest.getInstance("SHA1");
      paramString = paramString + "abcdef10";
      for (int i = 0; i < paramString.length(); i++) {
        localMessageDigest.update(Byte.valueOf(paramString.substring(i, i + 1), 16).byteValue());
      }

      localObject1 = localMessageDigest.digest();
      String str = "";
      for (int m : localObject1) {
        str = str + Integer.toHexString(0xFF & m);
      }
      return str;
    }
    catch (Throwable localThrowable)
    {
      Object localObject1;
      (
        localObject1 = localThrowable)
        .printStackTrace();
    }
    return (String)null;
  }

  public static void main(String[] paramArrayOfString) {
    if (paramArrayOfString.length == 0) {
      System.out.println("CasaDeMarkatKeyGen [ecrSerialNumber](without '['']')"); return;
    }
    System.out.println("ecr serial number = " + paramArrayOfString[0] + ", License Code = " + getSerial(paramArrayOfString[0]));
  }
}

Adica , vreau sa criptez un cod [exemplu] :

111112
output-ul ar trebui sa fie (in urma functiei) :

1b5424d4f3926f597c0a394401d3e4a7f218b7


Multumesc mult!