Skip to content

SipHash24Streaming

[Source]

Provides SipHash24 for non-array data given as separate U64s.

Usage:

use "collections"

actor Main
  new create(env: Env) =>
    try
      let sip = SipHash24Streaming.create()
      for x in Range[U64](1, 100).values() do
        // feed consecutive U64s to be hashed
        sip.update(x)
      end
      // execute finishing steps, reset internal state so this instance can be
      // reused, and output the computed hash
      let hash = sip.finish()
      env.out.print("HASHED: " + hash.string())
    end
class ref SipHash24Streaming

Constructors

create

[Source]

new ref create()
: SipHash24Streaming ref^

Returns


Public Functions

reset

[Source]

Reset the internal state.

fun ref reset()
: None val

Returns


update

[Source]

Hash the given m and update the internal state accordingly.

fun ref update(
  m: U64 val)
: None val

Parameters

Returns


finish

[Source]

This method finally computes the hash from all the data added with update, and resets the internal state, so this instance can be conveniently reused for another hash calculation.

fun ref finish()
: U64 val

Returns