• Api Documentation
Show / Hide Table of Contents
  • CSChaCha20
    • ChaCha20
    • SimdMode
    • Util

Class Util

Utilities that are used during compression

Inheritance
object
Util
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: CSChaCha20
Assembly: .dll
Syntax
public static class Util

Methods

| Edit this page View Source

Add(uint, uint)

Unchecked integer addition. The ChaCha spec defines certain operations to use 32-bit unsigned integer addition modulo 2^32.

Declaration
public static uint Add(uint v, uint w)
Parameters
Type Name Description
uint v
uint w
Returns
Type Description
uint

The result of (v + w) modulo 2^32

Remarks

See ChaCha20 Spec Section 2.1.

| Edit this page View Source

AddOne(uint)

Add 1 to the input parameter using unchecked integer addition. The ChaCha spec defines certain operations to use 32-bit unsigned integer addition modulo 2^32.

Declaration
public static uint AddOne(uint v)
Parameters
Type Name Description
uint v
Returns
Type Description
uint

The result of (v + 1) modulo 2^32

Remarks

See ChaCha20 Spec Section 2.1.

| Edit this page View Source

Rotate(uint, int)

n-bit left rotation operation (towards the high bits) for 32-bit integers.

Declaration
public static uint Rotate(uint v, int c)
Parameters
Type Name Description
uint v
int c
Returns
Type Description
uint

The result of (v LEFTSHIFT c)

| Edit this page View Source

ToBytes(byte[], uint, int)

Serialize the input integer into the output buffer. The input integer will be split into 4 bytes and put into four sequential places in the output buffer, starting at the outputOffset.

Declaration
public static void ToBytes(byte[] output, uint input, int outputOffset)
Parameters
Type Name Description
byte[] output
uint input
int outputOffset
| Edit this page View Source

U8To32Little(byte[], int)

Convert four bytes of the input buffer into an unsigned 32-bit integer, beginning at the inputOffset.

Declaration
public static uint U8To32Little(byte[] p, int inputOffset)
Parameters
Type Name Description
byte[] p
int inputOffset
Returns
Type Description
uint

An unsigned 32-bit integer

| Edit this page View Source

XOr(uint, uint)

Unchecked integer exclusive or (XOR) operation.

Declaration
public static uint XOr(uint v, uint w)
Parameters
Type Name Description
uint v
uint w
Returns
Type Description
uint

The result of (v XOR w)

  • Edit this page
  • View Source
In this article
Back to top Generated by DocFX