我使用Speex語音庫編碼在P2P語音聊天應用程序/解碼字節組最有效的方式。 我一直在使用AES加密,但由於加密和解密的嘗試,我的UI線程掛斷。我將嘗試用僞代碼編寫問題。Android的加密/解密連續UDP(語音數據包)數據
OnPlayer方:
while(keep_on_running) {
socket.receive(packet);
encodedFrame = AESEncrytion.decrypt(encodedFrame);
Speex.decode(encodedFrame, encodedFrame.length, pcmFrame);
}
在記錄器側:
while(keep_on_running) {
Speex.encode(pcmFrame, encodedFrame);
AESEncrytion.encrypt(encodedFrame);
socket.send(packet)
}
我想知道內情的最佳可能的方式來encrpyt /解密連續數據流。
但它會用於加密/解密來自UDP數據包的數據。有些數據包也丟失了...... – SoH
@SoH肯定 - 只要你有[nonce](http://en.wikipedia.org/wiki/Cryptographic_nonce)(在許多加密庫中稱爲IV),你可以保持雙方同步 –