sending dgram messages between big and little endien with blowfish

287 Views Asked by At

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 issue with decrypting my message or is it elsewhere?

Thanks

2

There are 2 best solutions below

0
On
  1. No it doesn't.

  2. Your blowfish code is likely not handling endianness properly, this could be encryption, decryption, or both. Without code we can't say.

0
On

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