朋友你好,很高兴为你作答。
首先,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字符转换为字母,这个字母可能是汉字,但更可能是外国符文,反正一般人不会认出来的。你解密的时候,倒推一下就行了。