国产精品天干天干,亚洲毛片在线,日韩gay小鲜肉啪啪18禁,女同Gay自慰喷水

歡迎光臨散文網(wǎng) 會(huì)員登陸 & 注冊(cè)

Android Studio 修改 QPython OC/3C 使支持 Javax.Crypto.Cipher 加解密

2021-05-01 14:25 作者:乘著船  | 我要投稿

適合軟件平臺(tái):QPython 3C (Python 3.10),https://www.bilibili.com/read/cv13322251


新增11個(gè)SL4A函數(shù),其中第1個(gè)cipherInit首次正確運(yùn)行后,后面10個(gè)才會(huì)被導(dǎo)入。


? cipherInit( key, algorithm = "AES/CBC/PKCS5Padding", encodingFormat = "", initialVector = "" )

Cipher Initialize

key (String / Bytes)

algorithm (String Optional)

encodingFormat (String Optional)

initialVector (String / Bytes Optional)

if encodingFormat is UTF-8 or GBK etc., key and initialVector are Normal ( UTF-8 or GBK etc. ) String, if encodingFormat is omitted ( empty default ) , key and initialVector are Base64 String or Bytes .

algorithm support AES or DES etc.

if algorithm is AES, key need 16/24/32 bytes, if algorithm is DES, key need 8 bytes.

If initialVector used in AES/CBC algorithm, it need 16 bytes; if initialVector used in DES/CBC algorithm, it need 8 bytes.

If initialVector is omitted ( empty default ), then initialVector is set to be the same as key.


密碼初始化( 密鑰, 算法 = "AES/CBC/PKCS5Padding", 文字編碼 = "", 初始向量 = "" )

密碼初始化

密鑰 (字符串 / 字節(jié)串)

算法 (字符串 可選參數(shù))

文字編碼 (字符串 可選參數(shù))

初始向量 (字符串 / 字節(jié)串 可選參數(shù))

如果 文字編碼 是 UTF-8或GBK等, 那么 密鑰 和 初始向量 是 普通 ( UTF-8或GBK等 ) 字符串, 如果 文字編碼 被省略 ( 默認(rèn)為空 ) , 那么 密鑰 和 初始向量 是 Base64 字符串 或 字節(jié)串 .

算法 支持 AES或DES等

如果 算法 是 AES, 那么 密鑰 需要 16/24/32 字節(jié), 如果 算法 是 DES, 那么 密鑰 需要 8 字節(jié).

如果初始向量被用在 AES/CBC 算法上,需要 16 字節(jié);如果初始向量被用在 DES/CBC 算法上,需要 8 字節(jié).

如果 初始向量 被省略 ( 默認(rèn)為空 ), 那么初始向量會(huì)被設(shè)置為和密鑰一樣.


? decryptBytes( srcBytes )

? Decrypt a Bytes to another Bytes,

? needs to run cipherInit first , and encodingFormat must omitted .

? srcBytes (Bytes)

??

? 解密字節(jié)串( 源字節(jié)串 )

? 解密 一個(gè) 字節(jié)串 到 另一個(gè) 字節(jié)串,

? 需要先運(yùn)行密碼初始化 , 同時(shí)文字編碼必須省略 .

? 源字節(jié)串 (字節(jié)串)

??

? decryptFile( srcFile, dstFile )

? Decrypt a File to another File,

? needs to run cipherInit first .

? srcFile (String)

? dstFile (String)

??

? 解密文件( 源文件, 目標(biāo)文件 )

? 解密 一個(gè) 文件 到 另一個(gè) 文件,

? 需要先運(yùn)行密碼初始化 .

? 源文件 (字符串)

? 目標(biāo)文件 (字符串)

??

? decryptFileToBytes( srcFile )

? Decrypt a File to another Bytes,

? needs to run cipherInit first , and encodingFormat must omitted .

? srcFile (String)

??

? 解密文件到字節(jié)串( 源文件 )

? 解密 一個(gè) 文件 到 另一個(gè) 字節(jié)串,

? 需要先運(yùn)行密碼初始化 , 同時(shí)文字編碼必須省略 .

? 源文件 (字符串)

??

? decryptFileToString( srcFile )

? Decrypt a File to another Normal / Base64 String,

? needs to run cipherInit first .

? srcFile (String)

??

? 解密文件到字符串( 源文件 )

? 解密 一個(gè) 文件 到 另一個(gè) 普通 / Base64 字符串,

? 需要先運(yùn)行密碼初始化 .

? 源文件 (字符串)

??

? decryptString( srcString )

? Decrypt a Base64 String to another Normal / Base64 String,

? needs to run cipherInit first .

? srcString (String)

??

? 解密字符串( 源字符串 )

? 解密 一個(gè) Base64 字符串 到 另一個(gè) 普通 / Base64 字符串,

? 需要先運(yùn)行密碼初始化 .

? 源字符串 (字符串)

??

? encryptBytes( srcBytes )

? Encrypt a Bytes to another Bytes ,

? needs to run cipherInit first , and encodingFormat must omitted .

? srcBytes (Bytes)

??

? 加密字節(jié)串( 源字節(jié)串 )

? 加密 一個(gè) 字節(jié)串 到 另一個(gè) 字節(jié)串 ,

? 需要先運(yùn)行密碼初始化 , 同時(shí)文字編碼必須省略 .

? 源字節(jié)串 (字節(jié)串)

??

? encryptBytesToFile( srcBytes, dstFile )

? Encrypt a Bytes to another File ,

? needs to run cipherInit first , and encodingFormat must omitted .

? srcBytes (Bytes)

? dstFile (String)

??

? 加密字節(jié)串到文件( 源字節(jié)串, 目標(biāo)文件 )

? 加密 一個(gè) 字節(jié)串 到 另一個(gè) 文件 ,

? 需要先運(yùn)行密碼初始化 , 同時(shí)文字編碼必須省略 .

? 源字節(jié)串 (字節(jié)串)

? 目標(biāo)文件 (字符串)

??

? encryptFile( srcFile, dstFile )

? Encrypt a File to another File,

? needs to run cipherInit first .

? srcFile (String)

? dstFile (String)

??

? 加密文件( 源文件, 目標(biāo)文件 )

? 加密 一個(gè) 文件 到 另一個(gè) 文件,

? 需要先運(yùn)行密碼初始化 .

? 源文件 (字符串)

? 目標(biāo)文件 (字符串)

??

? encryptString( srcString )

? Encrypt a Normal / Base64 String to another Base64 String ,

? needs to run cipherInit first .

? srcString (String)

??

? 加密字符串( 源字符串 )

? 加密 一個(gè) 普通 / Base64 字符串 到 另一個(gè) Base64 字符串 ,

? 需要先運(yùn)行密碼初始化 .

? 源字符串 (字符串)

??

? encryptStringToFile( srcString, dstFile )

? Encrypt a Normal / Base64 String to another File ,

? needs to run cipherInit first .

? srcString (String)

? dstFile (String)

??

? 加密字符串到文件( 源字符串, 目標(biāo)文件 )

? 加密 一個(gè) 普通 / Base64 字符串 到 另一個(gè) 文件 ,

? 需要先運(yùn)行密碼初始化 .

? 源字符串 (字符串)

? 目標(biāo)文件 (字符串)


?示例:


encryptBytes / decryptBytes
encryptString / decryptString
encryptBytesToFile / decryptFileToBytes
encryptStringToFile / decryptFileToString
encryptFile / decryptFile

??

原理:使用了 Javax.Crypto.Cipher 模塊和 SL4A 服務(wù)。

支持的加密算法,請(qǐng)查看 Javax.Crypto.Cipher?類?說(shuō)明,本文不再贅述:https://blog.csdn.net/u011502243/article/details/90749984


從 QPython OP 引出一個(gè)新小分支?QPython OC/3C?( QPython?修改版 ) 。

如果需要?QPython 3C?源代碼/Apk ,請(qǐng)點(diǎn)擊以下鏈接:

作者:乘著船@Bilibili

更多文章+下載鏈接:https://www.bilibili.com/read/readlist/rl321663


Android Studio 修改 QPython OC/3C 使支持 Javax.Crypto.Cipher 加解密的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國(guó)家法律
海伦市| 措勤县| 德昌县| 文化| 嘉鱼县| 许昌市| 太和县| 涿州市| 固始县| 讷河市| 敦煌市| 凤凰县| 兴安盟| 巴中市| 临江市| 江口县| 孙吴县| 凤翔县| 金湖县| 织金县| 西和县| 岳西县| 晋宁县| 漠河县| 达州市| 赞皇县| 和平区| 巢湖市| 龙州县| 沧源| 桐城市| 宝应县| 临桂县| 吉木萨尔县| 苗栗县| 福州市| 信阳市| 忻城县| 平塘县| 会宁县| 阿克|