Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.kma.ctf2;
- import java.security.MessageDigest;
- import javax.crypto.Cipher;
- import javax.crypto.spec.SecretKeySpec;
- import sun.misc.BASE64Decoder;
- public class Decode1 {
- public String returnFlag() {
- try {
- MessageDigest localMessageDigest = MessageDigest.getInstance("SHA");
- localMessageDigest.update("KMA_fag_not_here".getBytes());
- SecretKeySpec localSecretKeySpec = new SecretKeySpec(localMessageDigest.digest(), 0, 16, "AES");
- Cipher localCipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
- // byte[] arrayOfByte = Base64.decode("rMto79APL5CFQ9PU6iSP6e2tbxRJ6Xv0s5znSnYneog=", 0);
- BASE64Decoder decoder = new BASE64Decoder();
- byte[] arrayOfByte = decoder.decodeBuffer("rMto79APL5CFQ9PU6iSP6e2tbxRJ6Xv0s5znSnYneog=");
- //
- localCipher.init(2, localSecretKeySpec);
- String str = new String(localCipher.doFinal(arrayOfByte));
- return str;
- } catch (Exception localException) {
- localException.printStackTrace();
- }
- return null;
- }
- public static void main(String[] args) {
- Decode1 dc = new Decode1();
- System.out.println("" + dc.returnFlag());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment