我尝试将AES-256加密的输出连接到一个字符串(将此字符串与从Android手机发送的加密字符串进行比较).
基本上,连接似乎有效,但经过几次运行错误(不可读的字符,字符串变短而不是更长)或崩溃发生.它是可重现的,在重启后在完全相同的点崩溃.
我提取了一些演示问题的Arduino代码.它执行以下操作:
#include <SPI.h>
#include "aes256.h" //include this lib
uint8_t key[] = {9,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8,
1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8 }; //the encryption key
aes256_context ctxt; //context needed for aes library
void setup() {
Serial.begin(9600);
}
void loop() {
uint8_t data[] = {
0x53, 0x73, 0x64, 0x66, 0x61, 0x73, 0x64, 0x66,
0x61, 0x73, 0x64, 0x66, 0x61, 0x73, 0x64, 0x65, }; //the message to be encoded
long InitialRandom = random(2147483647); //0 to highest possible long
String RandomString = "" ;
RandomString+=InitialRandom; //random …Run Code Online (Sandbox Code Playgroud) 我想创建一个包含列表中所有URL的字符串数组.
我有一个存储在列表对象中的URL列表myUrlList.使用myUrlList.toString();返回String表单中的a [http://url1, http://url2, http://url3.....].
此外,myUrlList.getSize()正确返回列表包含的URL数.
如何获取列表中所有URL的数组?我试过了myUrlList.toArray,(String[]) myUrlList.toArray()其他人没有成功.甚至不可能使用获得一个元素myUrlList.get(position).