Casper.Network.SDK
Show / Hide Table of Contents

Class CEP57Checksum

CEP 0057 introduces a checksum for hex-encoded values based on the capitalization of letters in an hexadecimal string.

Inheritance
System.Object
CEP57Checksum
Namespace: Casper.Network.SDK.Utils
Assembly: Casper.Network.SDK.dll
Syntax
public class CEP57Checksum : object

Fields

InvalidChecksum

Declaration
public const int InvalidChecksum = null
Field Value
Type Description
System.Int32

NoChecksum

Declaration
public const int NoChecksum = null
Field Value
Type Description
System.Int32

ValidChecksum

Declaration
public const int ValidChecksum = null
Field Value
Type Description
System.Int32

Methods

Decode(String, out Int32)

Converts an hexadecimal string to an array of bytes. If the string contains a valid checksum, checksumResult returns CEP57Checksum.ValidChecksum. If the string contains an invalid checksum, checksumResultreturns CEP57Checksum.InvalidChecksum. checkumResultreturns CEP57Checksum.NoChecksum if the string does not include CEP57 checksum.

Declaration
public static byte[] Decode(string hex, out int checksumResult)
Parameters
Type Name Description
System.String hex
System.Int32 checksumResult
Returns
Type Description
System.Byte[]

Encode(Byte[])

Encodes an array of bytes into an hexadecimal string with CEP57 checksum. Arrays longer than 75 bytes do not include the checksum.

Declaration
public static string Encode(byte[] input)
Parameters
Type Name Description
System.Byte[] input
Returns
Type Description
System.String

HasChecksum(String)

Returns true if the input hexadecimal string includes the CEP57 checksum. An string includes checksum when letters are mixed-cased.

Declaration
public static bool HasChecksum(string hex)
Parameters
Type Name Description
System.String hex
Returns
Type Description
System.Boolean

See Also

CEP 0057 Checksummed Addresses
In This Article
Back to top Maintained by MAKE Technology LLC