朋友你好,很高興為你作答。
首先,Java加密能夠應對的風險包括以下幾個:
1、核心技術竊取
2、核心業務破解
3、通信模塊破解
4、API介面暴露
本人正在使用幾維安全Java加密方式,很不錯,向你推薦,希望能夠幫助到你。
幾維安全Java2C針對DEX文件進行加密保護,將DEX文件中標記的Java代碼翻譯為C代碼,編譯成加固後的SO文件。默認情況只加密activity中的onCreate函數,如果開發者想加密其它類和方法,只需對相關類或函數添加標記代碼,在APK加密時會自動對標記的代碼進行加密處理。
與傳統的APP加固方案相比,不涉及到自定義修改DEX文件的載入方式,所以其兼容性非常好;其次Java函數被完全轉化為C函數,直接在Native層執行,不存在Java層解密執行的步驟,其性能和執行效率更優。
如果操作上有不明白的地方,可以聯系技術支持人員幫你完成Java加密。
希望以上解答能夠幫助到你。
❷ java有沒有加密字元串為一串數字的演算法
package cn.sdeit.beans;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import cn.sdeit.mysql.ConnectMySql;
public class User
{
private String email;
private String password;
private String rePassword;
private String tel;
private String name;
private String sex;
private String birthday;
private String university;
private String major;
private String sID;
private int year;
public User(String email, String password, String rePassword,
String tel, String name, String sex, String birthday,
String university, String major, String sID, int year)
{
super();
this.email = email;
this.password = password;
this.rePassword = rePassword;
this.tel = tel;
this.name = name;
this.sex = sex;
this.birthday = birthday;
this.university = university;
this.major = major;
this.sID = sID;
this.year = year;
}
public User(String email)
{
super();
/*
* 此構造方法目的獲取 UserBean 對象
* */
this.email = email;
}
public String getEmail()
{
return email;
}
public void setEmail(String email)
{
this.email = email;
❸ java數字 加密
加密?
MD5
郁悶噢..不太有用的了~~
❹ java,3des加密,主密鑰和工作密鑰都是固定的32個1,想要加密6位密碼,求實現代碼
很多代碼生成的加密結果是==
這樣的,這種結果不是我需要的3DES加密結果,各位幫忙下,有沒有可以實現我說的那種3DES的java實現類,!
❺ java 怎樣實現 64位的md5加密演算法
直接引入「commons-codec-1.10.jar」這個java包,然後調用相應方法即可
比如我們可以寫一個方法類,把常用的方法都寫進去:
publicclassEncryptionUtil{
/**
*Base64encode
**/
(Stringdata){
returnBase64.encodeBase64String(data.getBytes());
}
/**
*Base64decode
*@
**/
(Stringdata){
returnnewString(Base64.decodeBase64(data.getBytes()),"utf-8");
}
/**
*md5
**/
publicstaticStringmd5Hex(Stringdata){
returnDigestUtils.md5Hex(data);
}
/**
*sha1
**/
publicstaticStringsha1Hex(Stringdata){
returnDigestUtils.sha1Hex(data);
}
/**
*sha256
**/
publicstaticStringsha256Hex(Stringdata){
returnDigestUtils.sha256Hex(data);
}
}
(PS:純手打,望採納)
❻ java編寫數字加密解密
//package wangcai.test;
public interface Endecryption {
public static final byte[] EN={48,49,50,51,52,53,54,55,56,57};
public static final byte[] DE={55,53,57,49,51,54,56,48,50,52};
}
//package wangcai.test;
import java.util.Scanner;
public class Cryption implements Endecryption{
/*
* 原始數字與加密後得到的密文數字之間的對應關系如下:
原始數字:0 1 2 3 4 5 6 7 8 9
密文數字:7 5 9 1 3 6 8 0 2 4
試編寫程序把原始數字轉換成加密密文或把加密密文轉換成原始數字。
輸入:
1 6 (第一個數表示加密或解密:1加密,2解密;第二個數表示數字的個數)
1 9 9 7 7 1 (待處理的數字內容)
輸出:
5 4 4 0 0 5
*/
public static void main(String[] args)
{
Scanner sc=new Scanner(System.in);
Cryption c=new Cryption();
System.out.println("請輸入是加密還是解密:1加密,2解密");
int ende=sc.nextInt();
if(ende==1)
{
System.out.println("請輸入加密的數字個數");
int num=sc.nextInt();
System.out.println("請輸入"+num+"個數字");
String temp=new Scanner(System.in).nextLine();
System.out.println(c.Encryption(temp));
}
else if(ende==2)
{
System.out.println("請輸入解密的數字個數");
int num=sc.nextInt();
System.out.println("請輸入"+num+"個數字");
String temp=new Scanner(System.in).nextLine();
System.out.println(c.Decryption(temp));
}
else
{
System.out.println("輸入錯誤");
}
}
/**
* 加密
* @param temp
* @return
*/
public String Encryption(String temp)
{
String result="";
byte[] temp_byte=temp.getBytes();
for(byte b:temp_byte)
{
int i=0;
for(;i<EN.length;i++)
{
if(b==EN[i])
{
result+=(char)DE[i];
break;
}
}
if(i==EN.length)
{
result+=(char)b;
}
}
return result;
}
/**
* 解密
* @param temp
* @return
*/
public String Decryption(String temp)
{
String result="";
byte[] temp_byte=temp.getBytes();
for(byte b:temp_byte)
{
int i=0;
for(;i<DE.length;i++)
{
if(b==DE[i])
{
result+=(char)EN[i];
break;
}
}
if(i==DE.length)
{
result+=(char)b;
}
}
return result;
}
}
加密解密方面的一般採用byte來實現
❼ 請問java里將某個文本進行加密成了6位的數字+字母,請問是什麼加密方式,加密成的值字母區分大小寫。
這個加密不知道行不行?
public class Escape {
private final static String[] hex = { "00", "01", "02", "03", "04", "05",
"06", "07", "08", "09", "0A", "0B", "0C", "0D", "0E", "0F", "10",
"11", "12", "13", "14", "15", "16", "17", "18", "19", "1A", "1B",
"1C", "1D", "1E", "1F", "20", "21", "22", "23", "24", "25", "26",
"27", "28", "29", "2A", "2B", "2C", "2D", "2E", "2F", "30", "31",
"32", "33", "34", "35", "36", "37", "38", "39", "3A", "3B", "3C",
"3D", "3E", "3F", "40", "41", "42", "43", "44", "45", "46", "47",
"48", "49", "4A", "4B", "4C", "4D", "4E", "4F", "50", "51", "52",
"53", "54", "55", "56", "57", "58", "59", "5A", "5B", "5C", "5D",
"5E", "5F", "60", "61", "62", "63", "64", "65", "66", "67", "68",
"69", "6A", "6B", "6C", "6D", "6E", "6F", "70", "71", "72", "73",
"74", "75", "76", "77", "78", "79", "7A", "7B", "7C", "7D", "7E",
"7F", "80", "81", "82", "83", "84", "85", "86", "87", "88", "89",
"8A", "8B", "8C", "8D", "8E", "8F", "90", "91", "92", "93", "94",
"95", "96", "97", "98", "99", "9A", "9B", "9C", "9D", "9E", "9F",
"A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7", "A8", "A9", "AA",
"AB", "AC", "AD", "AE", "AF", "B0", "B1", "B2", "B3", "B4", "B5",
"B6", "B7", "B8", "B9", "BA", "BB", "BC", "BD", "BE", "BF", "C0",
"C1", "C2", "C3", "C4", "C5", "C6", "C7", "C8", "C9", "CA", "CB",
"CC", "CD", "CE", "CF", "D0", "D1", "D2", "D3", "D4", "D5", "D6",
"D7", "D8", "D9", "DA", "DB", "DC", "DD", "DE", "DF", "E0", "E1",
"E2", "E3", "E4", "E5", "E6", "E7", "E8", "E9", "EA", "EB", "EC",
"ED", "EE", "EF", "F0", "F1", "F2", "F3", "F4", "F5", "F6", "F7",
"F8", "F9", "FA", "FB", "FC", "FD", "FE", "FF" };
private final static byte[] val = { 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x00, 0x01,
0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x3F, 0x3F, 0x3F,
0x3F, 0x3F, 0x3F, 0x3F, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x3F,
0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
0x3F, 0x3F, 0x3F, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x3F, 0x3F,
0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F };
/**
* Unicode 格式 編碼
*
* @param s
* @return
*/
public static String escape(String s) {
StringBuffer sbuf = new StringBuffer();
int len = s.length();
for (int i = 0; i < len; i++) {
int ch = s.charAt(i);
if ('A' <= ch && ch <= 'Z') {
sbuf.append((char) ch);
} else if ('a' <= ch && ch <= 'z') {
sbuf.append((char) ch);
} else if ('0' <= ch && ch <= '9') {
sbuf.append((char) ch);
} else if (ch == '-' || ch == '_'
|| ch == '.' || ch == '!' || ch == '~' || ch == '*'
|| ch == '\'' || ch == '(' || ch == ')') {
sbuf.append((char) ch);
} else if (ch <= 0x007F) {
sbuf.append('%');
sbuf.append(hex[ch]);
} else {
sbuf.append('%');
sbuf.append('u');
sbuf.append(hex[(ch >>> 8)]);
sbuf.append(hex[(0x00FF & ch)]);
}
}
return sbuf.toString();
}
/**
* 解碼 說明:本方法保證 不論參數s是否經過escape()編碼,均能得到正確的「解碼」結果
*
* @param s
* @return
*/
public static String unescape(String s) {
StringBuffer sbuf = new StringBuffer();
int i = 0;
int len = s.length();
while (i < len) {
int ch = s.charAt(i);
if ('A' <= ch && ch <= 'Z') {
sbuf.append((char) ch);
} else if ('a' <= ch && ch <= 'z') {
sbuf.append((char) ch);
} else if ('0' <= ch && ch<= '9') {
sbuf.append((char) ch);
} else if (ch == '-' || ch == '_'|| ch == '.' || ch == '!' || ch == '~' || ch == '*'|| ch == '\'' || ch == '(' || ch == ')') {
sbuf.append((char) ch);
} else if (ch == '%') {
int cint = 0;
if ('u' != s.charAt(i + 1)) {
cint = (cint << 4) | val[s.charAt(i + 1)];
cint = (cint << 4) | val[s.charAt(i + 2)];
i += 2;
} else {
cint = (cint << 4) | val[s.charAt(i + 2)];
cint = (cint << 4) | val[s.charAt(i + 3)];
cint = (cint << 4) | val[s.charAt(i + 4)];
cint = (cint << 4) | val[s.charAt(i + 5)];
i += 5;
}
sbuf.append((char) cint);
} else {
sbuf.append((char) ch);
}
i++;
}
return sbuf.toString();
}
/**
* 把unicode編碼轉換成正常字元
*
* @param hex
* @return
*/
public static String binaryToUnicode(String hex) {
String strContent = "";
try {
int i;
int n;
int j;
n = hex.length() / 4;
j = 0;
char[] content = new char[n];
for (i = 0; i < n; i++) {
j = i * 4;
content[i] = (char) Integer.parseInt(hex.substring(j, j + 4),
16);
}
strContent = new String(content);
} catch (Exception ex) {
ex.printStackTrace();
strContent = "";
}
return strContent;
}
/**
* 把字元轉換成unicode編碼
*
* @param content
* @return
*/
public static String unicodeToBinary(String content) {
String hexStr = "";
try {
char[] contentBuffer = content.toCharArray();
String s;
int n;
for (int i = 0; i < content.length(); i++) {
n = (int) contentBuffer[i];
s = Integer.toHexString(n);
if (s.length() > 4) {
s = s.substring(0, 4);
} else {
s = "0000".substring(0, 4 - s.length()) + s;
}
hexStr = hexStr + s;
}
} catch (Exception ex) {
hexStr = "";
}
return hexStr.toUpperCase();
}
public static void main(String[] args) {
// String stest = "\"asd請選擇";
// System.out.println(escape(stest));
// System.out.println(unescape(escape(stest))+"||"+unescape(stest));
// System.out.println("0----9:"+(int)'0'+"--------"+(int)'9');
// System.out.println("A----Z:"+(int)'A'+"--------"+(int)'Z');
// System.out.println("a----z:"+(int)'a'+"--------"+(int)'z');
// System.out.println("-:"+(int)'-'+"||" +(int)'_'+"||"+(int)'.'
// +"||" +(int)'!'+"||"
// +(int)'~'+"||"+(int)'*'+"||"+(int)'\''+"||"
// +(int)'('+"||"+(int)')'+"||");
// for (int i = 0; i < 128; i++) {
// if (i%10==0) {
// System.out.print(" "+i+"="+(char)i+"\n");
// }else{
// System.out.print(" "+i+"="+(char)i);
// }
// // char ch = (char)i;
// // if (ch == '-' || ch == '_'|| ch == '.' || ch == '!' || ch == '~' || ch == '*'|| ch == '\'' || ch == '(' || ch == ')') {
// // System.out.println(ch+"="+(int)ch+" ");
// // }
// }unescape(String s)
System.out.println(Escape.unescape("撒33范德薩"));
System.out.println(Escape.unicodeToBinary("戰略績效計劃調整"));
System.out.println(Escape.binaryToUnicode(""));
System.out.println(Escape.unescape("%u6492%u8303%u5FB7%u8428%u9426"));
}
}
❽ Java編程如何給數字加密
最簡單的,用異或運算。
你也可以自己寫個加密方法啊。
比如說:利用unicode字元加密啊。假設一個數字a它的unicode值是1234,你自己設計個函數,比如說y=2x^3+3,得到一個新的unicode字元,然後把這個unicode字元轉換為字母,這個字母可能是漢字,但更可能是外國符文,反正一般人不會認出來的。你解密的時候,倒推一下就行了。