cookie CmCalculateDigest

Description

CmCalculateDigest() calculates a 32 bytes digest from the given input sequence using a SHA-256 hash algorithm for later usage in an authentication process.

tmr_02

Triple Mode Redundancy-related information (TMR)

  • C, C++
  • C#
  • Python

Syntax

int CMAPIENTRY CmCalculateDigest(CMBYTE *pbInput, CMUINT cbInput, CMBYTE *pbDigest, CMUINT cbDigest);

Parameter

pbInput contains the buffer for the message to calculate the digest.

cbInput contains the length of the buffer of pbInput.

pbDigest contains the buffer for the digest.

cbDigest contains the length of the buffer of pbDigest.

Return

The length of the returned signature is returned. If an error occurred, 0 is returned and an error code is set. If pbDigest does not contain enough memory, the number of needed bytes will be returned. In this case, the return value is larger than the cbDigest parameter and the error code CMERROR_BUFFER_OVERFLOW is set.

Syntax

This method is overloaded, i.e. the same method name is used with different type of parameters or different set of parameters.

Method 1:

public bool CmCalculateDigest(byte[] Input, out byte[] Digest);

This method overload calculates the digest from the given byte input sequence and returns a byte digest.

Parameter

byte[] Input contains the input of the sequence for the digest as Byte array.

out byte[] contains the output of the digest as Byte array

Method2:

public bool CmCalculateDigest(byte[] Input, CmAuthenticate CmAuth)

This method overload calculates the digest from the given byte input sequence and returns a byte digest in the class hmtoggle_plus1 CmAuthenticate.

Parameter

byte[] Input contains the input of the sequence for the digest as Byte array.

the class CmAuthenticate CmAuth contains the output in the property digest.

 

Syntax

import cmapi
 
cmapi.CodeMeter().CmCalculateDigest(data: bytes) -> bytes
throws CodeMeterApiFailedException()

Parameter

bytes contains the input of the sequence for the digest as Byte array.

Return

The output of the digest as Byte array..