gctf2017一道安卓逆向

时间:2020-12-17 19:17:09

apk1

package demo1;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class nac {  
    public nac(){   
    }
    public static void main(String args[]) throws NoSuchAlgorithmException {
        String paramString1 = "Tenshine";
        Object localObject = MessageDigest.getInstance("MD5");
        ((MessageDigest)localObject).reset();
        ((MessageDigest)localObject).update(paramString1.getBytes());
        paramString1 = toHexString(((MessageDigest)localObject).digest(), "");
        localObject = new StringBuilder();
        int i = 0;
        while (i < paramString1.length())
        {
            ((StringBuilder)localObject).append(paramString1.charAt(i));
            i += 2;
        }
        paramString1 = ((StringBuilder)localObject).toString();
        System.out.println("flag{" + paramString1 + "}");
    }
    private static String toHexString(byte[] paramArrayOfByte, String paramString)
    {
    StringBuilder localStringBuilder = new StringBuilder();
    int j = paramArrayOfByte.length;
    int i = 0;
    while (i < j)
    {
      String str = Integer.toHexString(paramArrayOfByte[i] & 0xFF);
      if (str.length() == 1) {
        localStringBuilder.append('0');
      }
      localStringBuilder.append(str).append(paramString);
      i += 1;
    }
    return localStringBuilder.toString();
  }

}