docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Struct xxHash3.StreamingState

    Type used to compute hash based on multiple data feed

    Namespace: Unity.Collections
    Assembly: Unity.Collections.dll
    Syntax
    public struct xxHash3.StreamingState
    Remarks

    Allow to feed the internal hashing accumulators with data through multiple calls to Update(void*, int), then retrieving the final hash value using DigestHash64() or DigestHash128(). More info about how to use this class in its constructor.

    Constructors

    StreamingState(bool, ulong)

    Create a StreamingState object, ready to be used with the streaming API

    Declaration
    public StreamingState(bool isHash64, ulong seed = 0)
    Parameters
    Type Name Description
    bool isHash64

    true if we are computing a 64bits hash value, false if we are computing a 128bits one

    ulong seed

    A seed value to be used to compute the hash, default is 0

    Remarks

    Once the object is constructed, you can call the Update(void*, int) method as many times as you want to accumulate data to hash. When all the data has been sent, call DigestHash64() or DigestHash128() to retrieve the corresponding key, the xxHash3.StreamingState instance will then be reset, using the same hash key size and same Seed in order to be ready to be used again.

    Methods

    DigestHash128()

    Compute the 128bits value based on all the data that have been accumulated

    Declaration
    public uint4 DigestHash128()
    Returns
    Type Description
    uint4

    The hash value

    DigestHash64()

    Compute the 64bits value based on all the data that have been accumulated

    Declaration
    public uint2 DigestHash64()
    Returns
    Type Description
    uint2

    The hash value

    Reset(bool, ulong)

    Reset the state of the streaming instance using the given seed value.

    Declaration
    public void Reset(bool isHash64, ulong seed = 0)
    Parameters
    Type Name Description
    bool isHash64
    ulong seed

    The seed value to alter the computed hash value from

    Remarks

    Call this method to start a new streaming session based on this instance

    Update(void*, int)

    Add some data to be hashed

    Declaration
    public void Update(void* input, int length)
    Parameters
    Type Name Description
    void* input

    The memory buffer, can't be null

    int length

    The length of the data to accumulate, can be zero

    Remarks

    This API allows you to feed very small data to be hashed, avoiding you to accumulate them in a big buffer, then computing the hash value from.

    Update<T>(in T)

    Add the contents of input struct to the hash.

    Declaration
    public void Update<T>(in T input) where T : unmanaged
    Parameters
    Type Name Description
    T input

    The input struct that will be hashed

    Type Parameters
    Name Description
    T

    The input type.

    Remarks

    This API allows you to feed very small data to be hashed, avoiding you to accumulate them in a big buffer, then computing the hash value from.

    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)