I have working code to send dgram messages between computers, but I'm trying to encrypt them with Blowfish. It works fine when I'm trying to send a message between two little endien machines, but when I try sending little endien to big (or the other way around), it doesn't decrypt correctly.
Question 1: Does sendto() convert my message to network byte ordering before sending it?
Question 2: Is this an iss开发者_如何学运维ue with decrypting my message or is it elsewhere?
Thanks
No it doesn't.
Your blowfish code is likely not handling endianness properly, this could be encryption, decryption, or both. Without code we can't say.
If you are encoding integer data in the messages sent through the socket, you should convert this to network byte order too. If you don't do this, your program may fail when running on or talking to other kinds of machines.
from GNU document. http://www.gnu.org/s/libc/manual/html_node/Byte-Order.html
精彩评论