Skip to content
FutureBlitz

    Install

    Import std.crypto.hashes

    Hasher

    std.crypto.hashes

    interface

    Public Interface Hasher

    What hashes bytes added to it in turn. Finish gives the hash of what was added, and starts again, empty.

    Examples

    Function HashOf(hasher: Hasher, parts: String[]): UInt8[]
        For part In parts
            hasher.Add(part)
        End For
        Return hasher.Finish()
    End Function
    
    Expect(HashOf(Sha256(), ["a", "b", "c"]) == Sha256.Hash("abc"))

    std/crypto/hashes.fb, line 41

    • Method Add(data: UInt8[]) method #

      Adds data to what it hashes.

    • Method Add(text: String) method #

      Adds text's UTF-8 bytes to what it hashes.

    • Method Finish(): UInt8[] method #

      The hash of what was added, which starts it again, empty.

    Report an issue with this page or with FutureBlitz on GitHub.