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

可逆演算法

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

閱讀全文

與可逆演算法相關的資料

熱點內容
仙境之路伺服器地址ip 瀏覽:707
華為服務app是什麼東西 瀏覽:180
關於單片機的視頻 瀏覽:591
淘寶直播app緩存怎麼清理 瀏覽:555
android可以刷機嗎 瀏覽:350
各城市8月程序員薪資 瀏覽:405
ins導航python 瀏覽:247
51單片機1us 瀏覽:218
上海突發天氣預警推送什麼app 瀏覽:740
壓縮機的供油 瀏覽:971
django開發的網站源碼 瀏覽:511
資料庫管理項目源碼 瀏覽:122
最新駱駝源碼app下載 瀏覽:50
網路答題用什麼app模板 瀏覽:550
linux伺服器如何配置多域名 瀏覽:250
pythonlibrary中文 瀏覽:551
客戶管理系統破解源碼 瀏覽:995
程序員皮皮 瀏覽:411
一個單片機一個程序 瀏覽:101
python調用系統時間 瀏覽:767