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

可逆演算法

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

閱讀全文

與可逆演算法相關的資料

熱點內容
linux環境下如何搭建伺服器 瀏覽:506
什麼是戰略pdf 瀏覽:517
20萬人用什麼伺服器 瀏覽:926
反編譯怎麼解決字串長度 瀏覽:279
農行app怎麼凍結賬號 瀏覽:759
mt反編譯的軟體打不開 瀏覽:518
安卓日上免稅APP如何安裝 瀏覽:583
怎麼買星空加密狗 瀏覽:19
北京程序員薪酬 瀏覽:133
華為榮耀暢玩8c升級方舟編譯器 瀏覽:412
手機怎麼把照片填入文件夾 瀏覽:305
php圖片輪換 瀏覽:929
科二學車app軟體哪個好 瀏覽:645
用aj踩東西的解壓視頻 瀏覽:382
將python編譯成手機app 瀏覽:475
程序員社招國企好進么 瀏覽:696
php路徑寫法 瀏覽:433
為什麼有些網頁安卓打不開 瀏覽:220
如何滲透獲取伺服器資料庫 瀏覽:778
ios是怎麼解析app的 瀏覽:256