自助推荐
立即入驻

B4X字符串加解密

博客2年前更新 桔子雨
954 00
B4X字符串加解密

代码如下

Private enc As B4XCipher
Private str1="测试文本",str2 As String
Private byte1(),byte2(),byte3() As Byte

'1,将字符串加密
byte1=enc.Encrypt(str1.GetBytes("utf8"),"123456")
'2,将加密后的字符数组转换成字符串
Dim BC As ByteConverter

Dim 输出 As String= BC.HexFromBytes(byte1)
Log(输出)
'byte3=enc.Decrypt(byte2,"123456")
'----还原并解密
Dim 还原后的byte() As Byte=BC.HexToBytes(输出)
Dim 解密后的byte() As Byte=enc.Decrypt(还原后的byte,"123456")
LogColor(BytesToString(解密后的byte,0,解密后的byte.Length,"utf8"),Colors.Green)
© 版权声明

相关文章