Common cryptography methods.
Combines two byte arrays into one.
public Byte[] CombineBytes(buffer1, buffer2)The combined byte array.
| Name | Type | Summary |
|---|---|---|
| buffer1 | Byte[] | The prefixed bytes. |
| buffer2 | Byte[] | The suffixed bytes. |
| Type | Summary |
|---|---|
| ArgumentNullException | Thrown when any of the input parameters are null. |
Determine if two byte arrays are equal.
public Boolean CompareBytes(byte1, byte2)true if the two byte array are equal; otherwise false.
| Name | Type | Summary |
|---|---|---|
| byte1 | Byte[] | The first byte array to compare. |
| byte2 | Byte[] | The byte array to compare to the first. |
Creates a unique ID from random bytes and converter it to an hexadecimal string. The resulting string is twice the size of the asked id size.
public String CreateUniqueId(length)A randomly generated unique id.
| Name | Type | Summary |
|---|---|---|
| length | Int32 | Length of the key to generate. |
Fills a byte array with a random set of aplhanumeric bytes.
public Void GetRandomAlphanumericBytes(bytes)| Name | Type | Summary |
|---|---|---|
| bytes | Byte[] | The byte array to fill. |
Creates a random set of alphanumeric bytes.
public Byte[] GetRandomAlphanumericBytes(size)The computes bytes.
| Name | Type | Summary |
|---|---|---|
| size | Int32 | The size of the byte array to generate. |
Fills a byte array with a cryptographically strong random set of bytes.
public Void GetRandomBytes(bytes)| Name | Type | Summary |
|---|---|---|
| bytes | Byte[] | The byte array to fill. |
Creates a cryptographically strong random set of bytes.
public Byte[] GetRandomBytes(size)The computed bytes.
| Name | Type | Summary |
|---|---|---|
| size | Int32 | The size of the byte array to generate. |
Transform an array of bytes according to the given cryptographic transform.
public Byte[] Transform(transform, buffer)Transformed array of bytes. It is the responsability of the caller to clear this byte array if necessary.
| Name | Type | Summary |
|---|---|---|
| transform | ICryptoTransform | ICryptoTransform used to transform the given buffer. |
| buffer | Byte[] | Buffer to transform. It is the responsability of the caller to clear this array when finished. |
| Type | Summary |
|---|---|
| ArgumentNullOrEmptyException | Thrown when the buffer is null. -or- buffer.Length is zero. |
| CryptographyException | Thrown when an error occurs while transforming the data. |
Transforms the source stream into the destination stream using the given cryptographic transform.
public Void TransformStream(transform, source, destination)| Name | Type | Summary |
|---|---|---|
| transform | ICryptoTransform | ICryptoTransform used to transform the stream. |
| source | Stream | The Stream to transform. |
| destination | Stream | The destination stream to put the results in. |
| Type | Summary |
|---|---|
| ArgumentNullException | Thrown when transform is null. -or- source is null. -or- destination is null. |
| CryptographyException | Thrown when an error occurs while transforming the data. |
Fills bytes zeros.
public Void ZeroOutBytes(bytes)| Name | Type | Summary |
|---|---|---|
| bytes | Byte[] | The byte array to fill. |