1. base64
1.1 實現方式
private static string srctest = "demo test";
@test
public void testbase64() throws ioexception
1.2 測試結果
2. aes對稱加密
2.1 應用場景
2.2 具體實現
@test
public void testaes() throws nosuchalgorithmexception, nosuchpaddingexception, invalidkeyexception, illegalblocksizeexception, badpaddingexception, unsupportedencodingexception
2.3 測試結果
3. 非對稱rsa加密演算法
3.1 應用場景
3.2 具體實現
@test
public void testrsa() throws nosuchalgorithmexception, invalidkeyspecexception, nosuchpaddingexception, invalidkeyexception, illegalblocksizeexception, badpaddingexception
3.3 測試結果
4. md加密演算法
4.1 應用場景
4.2 具體實現
@test
public void tes***5() throws nosuchalgorithmexception
4.3 測試結果
5. sha加密演算法
5.1 應用場景
5.2 具體實現
@test
public void testsha() throws nosuchalgorithmexception
5.3 測試結果
6. mac加密演算法
6.1 概念
mac(
message authentication code
,訊息認證碼演算法)是含有金鑰的雜湊函式演算法,相容了md和
sha演算法的特性,並在此基礎上加入了金鑰。訊息的雜湊值由只有通訊雙方知道的秘密金鑰
k來控制,因次,我們也常把
mac稱為
hmac
(keyed-hash message authentication code)
6.2 應用場景
6.3 具體實現
@test
public void testmac() throws nosuchalgorithmexception, invalidkeyexception
6.4 測試結果
總結:在進行介面測試的過程中,難免會遇到需要對引數的加密,所以有必要了解加密的一些方式,才能更加方便的構造資料。
常用的資料加密方式
常用加密方式 base64 sha1 secure hash algorithm 非對稱加密 sha256 非對稱加密 sha512 非對稱加密 md5 message digest algorithm 5 非對稱加密 rsa 非對稱加密 des data encryption standard 對...
iOS常用的加密方式
md5 ios 加密 建立md5類,如下 import inte ce cjmd5 nsobject nsstring md5hexdigest nsstring input end import cjmd5.h import implementation cjmd5 nsstring md5hex...
C 幾種常用的加密方式
aes演算法基於排列和置換運算。排列是對資料重新進行安排,置換是將乙個資料單元替換為另乙個。aes 使用幾種不同的方法來執行排列和置換運算。aes是乙個迭代的 對稱金鑰分組的密碼,它可以使用128 192 和 256 位金鑰,並且用 128 位 16位元組 分組加密和解密資料。與公共金鑰密碼使用金鑰...