All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.debugthug.scCryptography Maven / Gradle / Ivy

package com.github.debugthug;
/*
 * Decompiled with CFR 0_114.
 */
import java.security.Key;

import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;

import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;

@SuppressWarnings("restriction")
public class scCryptography {
    @SuppressWarnings("unused")
	private static final byte[] initVectorData = new byte[]{50, 51, 52, 53, 54, 55, 56, 57};
    String password = "Pas5pr@seairs";

    public String Encrypt(String string) throws Exception {
        Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
        byte[] arrby = new byte[16];
        byte[] arrby2 = this.password.getBytes("UTF-8");
        int n = arrby2.length;
        if (n > arrby.length) {
            n = arrby.length;
        }
        System.arraycopy(arrby2, 0, arrby, 0, n);
        SecretKeySpec secretKeySpec = new SecretKeySpec(arrby, "AES");
        IvParameterSpec ivParameterSpec = new IvParameterSpec(arrby);
        cipher.init(1, (Key)secretKeySpec, ivParameterSpec);
        byte[] arrby3 = cipher.doFinal(string.getBytes("UTF-8"));
        BASE64Encoder bASE64Encoder = new BASE64Encoder();
        return bASE64Encoder.encode(arrby3);
    }

    public String Decrypt(String string) throws Exception {
        Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
        byte[] arrby = new byte[16];
        byte[] arrby2 = this.password.getBytes("UTF-8");
        int n = arrby2.length;
        if (n > arrby.length) {
            n = arrby.length;
        }
        System.arraycopy(arrby2, 0, arrby, 0, n);
        SecretKeySpec secretKeySpec = new SecretKeySpec(arrby, "AES");
        IvParameterSpec ivParameterSpec = new IvParameterSpec(arrby);
        cipher.init(2, (Key)secretKeySpec, ivParameterSpec);
        BASE64Decoder bASE64Decoder = new BASE64Decoder();
        byte[] arrby3 = cipher.doFinal(bASE64Decoder.decodeBuffer(string));
        return new String(arrby3, "UTF-8");
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy