導航:首頁 > 源碼編譯 > 可逆演算法

可逆演算法

發布時間:2022-01-29 21:40:01

A. 不可逆加密演算法的壞處 為什麼需要可逆演算法來加密

比如說再做介面的時候 訪問介面需要帶參數但是明文不安全 如果用不可逆的加密在參數傳到介面後無法解密也就無法得知參數內容介面就無法使用 所以在做介面的參數傳遞的時候加密參數必須要用可逆也就是可解密的方式去做 目前可逆的加密一般都是非對稱的加密方式比如RSA

B. 可逆的加密演算法有啥

RAS公鑰演算法

C. 求一個用java編寫的可逆的加密演算法程序,自己寫的小程序也行。

public class mySecurity {
private static KeyGenerator keygen ;
private static SecretKey secretKey;
private static Cipher cipher;
private static mySecurity security = null;

private mySecurity(){
}
public static mySecurity getInstance() throws Exception{
if(security == null){
security = new mySecurity();
keygen = KeyGenerator.getInstance("AES");
secretKey = keygen.generateKey();
cipher =Cipher.getInstance("AES");
}
return security;
}

//加密
public String encrypt(String str) throws Exception{
cipher.init(Cipher.ENCRYPT_MODE,secretKey);

byte [] src = str.getBytes(); byte [] enc = cipher.doFinal(src);
return parseByte2HexStr(enc); }
//解密
public String decrypt(String str) throws Exception{
cipher.init(Cipher.DECRYPT_MODE,secretKey);

byte[] enc = parseHexStr2Byte(str); byte [] dec = cipher.doFinal(enc);
return new String(dec); }
/**將16進制轉換為二進制
* @param hexStr
* @return
*/
public static byte[] parseHexStr2Byte(String hexStr) {
if (hexStr.length() < 1)
return null;
byte[] result = new byte[hexStr.length()/2];
for (int i = 0;i< hexStr.length()/2; i++) {
int high = Integer.parseInt(hexStr.substring(i*2, i*2+1), 16);
int low = Integer.parseInt(hexStr.substring(i*2+1, i*2+2), 16);
result[i] = (byte) (high * 16 + low);
}
return result;
}

/**將二進制轉換成16進制
* @param buf
* @return
*/
public static String parseByte2HexStr(byte buf[]) {
StringBuffer sb = new StringBuffer();
for (int i = 0; i < buf.length; i++) {
String hex = Integer.toHexString(buf[i] & 0xFF);
if (hex.length() == 1) {
hex = '0' + hex;
}
sb.append(hex.toUpperCase());
}
return sb.toString();
}

public static void main(String[] args) throws Exception{
String str = "abc haha 我";
String ss = mySecurity.getInstance().encrypt(str) ;
System.out.println(ss);
System.out.println(mySecurity.getInstance().decrypt(ss));

}
}

D. 可逆矩陣的計算公式

計算公式:A^(-1)=(︱A︱)^(-1) A﹡(方陣A的行列式的倒數乘以A的伴隨矩陣)。

這個公式在矩陣A的階數很低的時候(比如不超過4階)效率還是比較高的,但是對於階數非常高的矩陣,通常我們通過對2n*n階矩陣[A In]進行行初等變換,變換成矩陣[In B],於是B就是A的逆矩陣。

矩陣的乘法滿足以下運算律:

結合律:的行向量(或列向量)線性無關。

假設M是一個m×n階矩陣,其中的元素全部屬於域K,也就是實數域或復數域。如此則存在一個分解,其中U是m×m階酉矩陣;Σ是m×n階實數對角矩陣;而V*,即V的共軛轉置,是n×n階酉矩陣。

這樣的分解就稱作M的奇異值分解 。Σ對角線上的元素Σi,i即為M的奇異值。常見的做法是將奇異值由大而小排列。如此Σ便能由M唯一確定了。

E. 網路上可逆、加密、壓縮、演算法一般有哪些

無損壓縮有:LZ77,LZ78,LZW, FLAC, WavPack, Monkey's Audio, PNG, Tiff
有損的有:mp3, mpeg1/2/4, h.264, h.265, avi, rm,

閱讀全文

與可逆演算法相關的資料

熱點內容
華為app怎麼刷 瀏覽:12
如何使用word生成加密pdf 瀏覽:988
vc軟體編譯後沒有結果 瀏覽:34
安卓現在使用的編譯器是哪個 瀏覽:186
java獲得文件路徑 瀏覽:607
linux帳號管理 瀏覽:34
編譯程序是干什麼用的 瀏覽:178
linux下編譯程序命令 瀏覽:637
杭州程序員高光 瀏覽:592
如何判斷單片機晶振好壞 瀏覽:942
程序員那麼可愛電視劇免費不卡 瀏覽:21
單片機馬達程序 瀏覽:595
我的世界怎麼用指令做一個伺服器 瀏覽:539
安卓手機截屏圖片是哪個文件夾 瀏覽:365
穿越到大學前前世是普通程序員 瀏覽:115
電腦如何連接學校伺服器地址 瀏覽:937
乘11的簡便演算法 瀏覽:45
資料庫工程師pdf 瀏覽:140
程序員圍觀圖 瀏覽:425
如何升安卓110系統 瀏覽:594