Verify endianess
This commit is contained in:
parent
0ac751b29f
commit
a668079894
1 changed files with 2 additions and 2 deletions
|
@ -170,7 +170,7 @@ impl KcpSegment {
|
|||
#[cfg(feature = "kuro-crc")]
|
||||
if self.use_checksum {
|
||||
let crc = crc32fast::hash(buf.iter().as_ref());
|
||||
buf.put_u32_le(crc); // Check correct endianness
|
||||
buf.put_u32_le(crc);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -972,7 +972,7 @@ impl<Output> Kcp<Output> {
|
|||
cursor.read_exact(&mut sbuf)?;
|
||||
let checksum = cursor.get_u32_le();
|
||||
cursor.set_position(backup);
|
||||
let expected = crc32fast::hash(&sbuf).to_be();
|
||||
let expected = crc32fast::hash(&sbuf);
|
||||
if checksum == expected {
|
||||
Ok(())
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue