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

可逆演算法

發布時間: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,

閱讀全文

與可逆演算法相關的資料

熱點內容
雲伺服器如何掛機賺錢 瀏覽:547
null是java關鍵字 瀏覽:686
看過讀過聽過是什麼APP 瀏覽:834
java判斷數據是否存在 瀏覽:15
一巴掌解壓圖片 瀏覽:976
自己搭建的伺服器如何安全 瀏覽:753
miui源碼公開 瀏覽:447
linuxbin是什麼 瀏覽:332
php小項目留言板 瀏覽:955
得推論壇系統源碼v24 瀏覽:67
android根據號碼查詢聯系人 瀏覽:496
命令行ftp上傳 瀏覽:338
大爺程序員 瀏覽:198
自私的基因pdf 瀏覽:475
程序員是怎麼做優化設置 瀏覽:251
命令與征服現代沖突視頻 瀏覽:678
基於單片機的文獻綜述 瀏覽:999
dnf掃貨腳本源碼 瀏覽:729
用於編譯器中緩解控制沖突的方法 瀏覽:194
rt3070aplinux 瀏覽:651