Struct xxHash3.StreamingState | Collections | 0.14.0-preview.16
docs.unity3d.com
    Show / Hide Table of Contents

    Struct xxHash3.StreamingState

    Type used to compute hash based on multiple data feed

    Namespace: Unity.Collections
    Syntax
    public struct StreamingState
    Remarks

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

    Constructors

    StreamingState(Boolean, UInt64)

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

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

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

    UInt64 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*, Int32) 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
    Unity.Mathematics.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
    Unity.Mathematics.uint2

    The hash value

    Reset(Boolean, UInt64)

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

    Declaration
    public void Reset(bool isHash64, ulong seed = 0UL)
    Parameters
    Type Name Description
    Boolean isHash64
    UInt64 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*, Int32)

    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

    Int32 length

    The length of the data to accumulate, can be zero

    Remarks

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

    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023