• Design
  • API Reference
  • Changelog
  • Contribute
Show / Hide Table of Contents
  • Libplanet
    • Address
    • AddressExtension
    • ByteUtil
    • Hashcash
    • Hashcash.Stamp
    • HashDigest<T>
    • HashDigestExtension
    • Nonce
  • Libplanet.Action
    • AccountStateGetter
    • ActionEvaluation<T>
    • ActionTypeAttribute
    • AddressStateMap
    • IAccountStateDelta
    • IAction
    • IActionContext
    • IRandom
    • MissingActionTypeException
    • PolymorphicAction<T>
  • Libplanet.Blockchain
    • BlockChain<T>
  • Libplanet.Blockchain.Policies
    • BlockPolicy<T>
    • BlockPolicyExtension
    • IBlockPolicy<T>
  • Libplanet.Blocks
    • Block<T>
    • InvalidBlockDifficultyException
    • InvalidBlockException
    • InvalidBlockHashException
    • InvalidBlockIndexException
    • InvalidBlockNonceException
    • InvalidBlockPreviousHashException
    • InvalidBlockTimestampException
  • Libplanet.Crypto
    • InvalidCiphertextException
    • PrivateKey
    • PublicKey
    • SymmetricKey
  • Libplanet.Net
    • BlockDownloadState
    • DifferentAppProtocolVersionException
    • DifferentProtocolVersionEventArgs
    • IceServer
    • IceServerException
    • InvalidMessageException
    • NoSwarmContextException
    • Peer
    • PeerNotFoundException
    • PeerSetDelta
    • Swarm
    • SwarmException
  • Libplanet.Serialization
    • BencodexFormatter<T>
    • SerializationInfoExtension
  • Libplanet.Store
    • BaseIndex<TKey, TVal>
    • BaseStore
    • BlockSet<T>
    • FileStore
    • IStore
    • NamespaceNotFoundException
    • TransactionSet<T>
  • Libplanet.Tx
    • InvalidTxException
    • InvalidTxIdException
    • InvalidTxNonceException
    • InvalidTxPublicKeyException
    • InvalidTxSignatureException
    • InvalidTxUpdatedAddressesException
    • Transaction<T>
    • TxId
    • UnexpectedlyTerminatedTxRehearsalException

Class ByteUtil

Utility methods to deal with Byte arrays.

Inheritance
Object
ByteUtil
Inherited Members
Object.Equals(Object)
Object.Equals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Object.ReferenceEquals(Object, Object)
Object.ToString()
Namespace: Libplanet
Assembly: Libplanet.dll
Syntax
public static class ByteUtil

Methods

| Improve this Doc View Source

CalculateHashCode(Byte[])

Calculates a deterministic hash code from a given bytes. It is mostly used to implement GetHashCode() method.

Declaration
[Pure]
public static int CalculateHashCode(byte[] bytes)
Parameters
Type Name Description
Byte[] bytes

A Byte array, which completely determines (or encodes) an object, to calculate a hash code.

Returns
Type Description
Int32

A hash code determined from the given bytes. For equivalent bytes, the same hash code is returned. It must not be null.

Exceptions
Type Condition
ArgumentNullException

Thrown when the given bytes is null.

| Improve this Doc View Source

Hex(Byte[])

Renders a hexadecimal string from a Byte array.

Declaration
[Pure]
public static string Hex(byte[] bytes)
Parameters
Type Name Description
Byte[] bytes

A Byte array to renders the corresponding hexadecimal string. It must not be null.

Returns
Type Description
String

A hexadecimal string which encodes the given bytes.

Exceptions
Type Condition
ArgumentNullException

Thrown when the given bytes is null.

| Improve this Doc View Source

ParseHex(String)

Converts a hexadecimal string to a Byte array.

Declaration
[Pure]
public static byte[] ParseHex(string hex)
Parameters
Type Name Description
String hex

A String which encodes Bytes in hexadecimal. Its length must be zero or an even number. It must not be null.

Returns
Type Description
Byte[]

A Byte array that the given hex string represented in hexadecimal. It lengthens the half of the given hex string.

Exceptions
Type Condition
ArgumentNullException

Thrown when the given hex string is null.

ArgumentOutOfRangeException

Thrown when the length of the given hex string is an odd number.

FormatException

Thrown when the given hex string is not a valid hexadecimal string.

  • Improve this Doc
  • View Source
Back to top Copyright © 2019 Planetarium
Generated by DocFX