nOffset | (Long) Specifies the position of read value in the data block.
The read value must be inside the data block. The item is read either whole or not read at all. >= 0 - Index (in bytes, zero-based index) in the data block.
-4 - The internal automatic position is used (see the AutoOffset property). It points behind the last read or written value. |
---|---|
nSize | (Long) The size of read data block.
The -1 value (default) means that the data block is read from the defined starting position to the end. |
sType | (String) Check sum type.
"crc1" - CRC-16-CCITT, 2 bytes Cyclical Redundancy Check with CCITT polynomial [0x1021 = x16+x12+x5+1].
Cyclical Redundancy Check of the array value bytes. The method returns a value of the Integer type (i.e. 2 bytes value). This checksum is used for example in communication by the protocol PmSBUS. "crc2" - CRC-16-IBM, 2 bytes Cyclical Redundancy Check with CCITT polynomial [0xA001 = x16+x15+x2+1].
Cyclical Redundancy Check of the array value bytes. The method returns a value of the Integer type (i.e. 2 bytes value). This checksum is used for example in communication by the protocol Modbus. "crc3" - CRC-16-IBM, 2 bytes Cyclical Redundancy Check with CCITT polynomial [0x8005 = x16+x15+x2+1].
Cyclical Redundancy Check of the array value bytes. The method returns a value of the Integer type (i.e. 2 bytes value). This checksum is used for example in communication by the protocol PmABradleyDF1. "crc4" - CRC-16, 2 bytes Cyclical Redundancy Check with CCITT polynomial [x16+x13+x12+x10+x8+x6+x5+x2+1].
Cyclical Redundancy Check of the array value bytes. The method returns a value of the Integer type (i.e. 2 bytes value). This checksum is used for example in communication by the protocol DNP3. "sum1" - Byte values sum.
The method returns a value of the Byte type (sum modulo 256). This checksum is used for example in communication by the protocol PmIEC8705, PmMBus, PmAdam, PmTeco, PmInmat66. "sum2" - Byte values sum.
The method returns a value of the Integer type (i.e. 2 bytes value) (sum modulo 65536). "xor1" - Bit XOR of all byte values.
The method returns a value of the Byte type. This checksum is used for example in communication by the protocol Pm3964. "md5" - MD5 hash of all byte values.
The MD5 hash size is 16 bytes, making the resulting HexaString 32 characters long. The method returns a value of the String type. "sha256" - SHA-256 hash of all byte values.
The SHA-256 hash size is 32 bytes, making the resulting HexaString 64 characters long. The method returns a value of the String type. "sha512" - SHA-512 hash of all byte values.
The SHA-512 hash size is 64 bytes, making the resulting HexaString 128 characters long. The method returns a value of the String type. |
var oBuf = Pm.CreatePmBuffer();
oBuf.SetInt32(-2, 0x10203040);
oBuf.SetInt16(-2, 0x5060);
oBuf.SetUint8(-2, 0x70);
var n = oBuf.CalcCheckSum(0, -1, "crc1");
var sMd5, sSha256;
var oBuf = Pm.CreatePmBuffer();
oBuf.SetStringVar(-2, "Test string", 1, 1);
sMd5 = oBuf.CalcCheckSum(0, -1, "md5");
sSha256 = oBuf.CalcCheckSum(0, -1, "sha256");