CryptoSys PKI Pro Manual

Cnv.NumFromBytes Method

Convert the leftmost four bytes of an array to an unsigned 32-bit integer.

Syntax

[C#]
public static uint NumFromBytes(
	byte[] b,
	Cnv.EndianNess endn
)
[VB.NET]
Public Shared Function NumFromBytes ( _
	b As Byte(), _
	endn As Cnv.EndianNess _
) As UInteger

Parameters

b
Byte array to be converted
endn
Type: Cnv.EndianNess
Byte order

Return Value

Integer value

Remarks

An array shorter than 4 bytes will be padded on the right with zeros

Example

[C#]
byte[] b = new byte[4] { 0xde, 0xad, 0xbe, 0xef };
uint nb = Cnv.NumFromBytes(b, Cnv.EndianNess.BigEndian);
Console.WriteLine("0x" + nb.ToString("x8"));  // 0xdeadbeef
uint nl = Cnv.NumFromBytes(b, Cnv.EndianNess.LittleEndian);
Console.WriteLine("0x" + nl.ToString("x8"));  // 0xefbeadde

See Also

VB6/C equivalent: CNV_NumFromBytes

[Contents] [Index]

[PREV: Cnv.HexFromBase64 Method...]   [Contents]   [Index]   
   [NEXT: Cnv.NumToBytes Method...]

Copyright © 2004-24 D.I. Management Services Pty Ltd. All rights reserved. Generated 2024-09-23T07:52:09Z.