Thread Prüfsumme MD5 (9 answers)
Opened by ITobiI at 2015-10-08 17:02

GwenDragon
 2015-10-09 09:21
#182543 #182543
User since
2005-01-17
14749 Artikel
Admin1
[Homepage]
user image
Ist prinzipiell so möglich:

Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
use Digest::MD5 qw(md5_hex);

$buffer = "\x01\x02Test";
$checksum = md5_hex($buffer);

$transfer_data = $checksum . $buffer;
...
# Daten senden
...
...
...

# Datenempfang
$receive_data = .....;

$checksum = substr($receive_data,0,32);
$buffer = substr($receive_data,32);

if (md5_hex($buffer) ne $checksum ) {
   # falsche Prüfsumme
   # Übertragung nicht ok
   ....
}

View full thread Prüfsumme MD5