Android Open Source - NotMinesweeper Guard






From Project

Back to project page NotMinesweeper.

License

The source code is released under:

Apache License

If you think the Android project NotMinesweeper listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.crazyks.mt;
//w ww.j  a  va  2s  .c  o  m
import java.security.Key;
import java.security.MessageDigest;

import javax.crypto.Cipher;

public class Guard {
  private final Cipher encryptCipher;
  private final Cipher decryptCipher;
  private final MessageDigest md;

  public Guard(byte[] bytes) throws Exception {
    Key key = getKey(bytes);

    encryptCipher = Cipher.getInstance("DES");
    encryptCipher.init(Cipher.ENCRYPT_MODE, key);

    decryptCipher = Cipher.getInstance("DES");
    decryptCipher.init(Cipher.DECRYPT_MODE, key);
    
    md = MessageDigest.getInstance("MD5");
  }

  private Key getKey(byte[] arrBTmp) throws Exception {
    byte[] arrB = new byte[8];
    for (int i = 0; i < arrBTmp.length && i < arrB.length; i++) {
      arrB[i] = arrBTmp[i];
    }
    return new javax.crypto.spec.SecretKeySpec(arrB, "DES");
  }

  public byte[] encrypt(byte[] arrB) throws Exception {
    return encryptCipher.doFinal(arrB);
  }

  public byte[] decrypt(byte[] arrB) throws Exception {
    return decryptCipher.doFinal(arrB);
  }
  
  public byte[] md5(byte[] arrB) throws Exception {
    md.update(arrB);
    return md.digest();
  } 

}




Java Source Code List

com.crazyks.mt.Achievements.java
com.crazyks.mt.AlertHelper.java
com.crazyks.mt.DateHelper.java
com.crazyks.mt.Egg.java
com.crazyks.mt.Gogogo.java
com.crazyks.mt.Guard.java
com.crazyks.mt.MT.java
com.crazyks.mt.NotMinesweeper.java
com.crazyks.mt.Tmp.java