Skip to content
FutureBlitz

    Install

    Import std.crypto.hashes

    std.crypto.hashes

    Md5, Sha1, Sha256, and Sha512, over mbedTLS: each one's Hash gives the hash of bytes, or of a String's bytes, at once, and an object of it adds them in turn. MD5 and SHA-1 are broken, since two inputs with one hash can be made, so they're only for checksums and the formats that ask for them; Sha256 and Sha512 are for the rest.

    std/crypto/hashes.fb

    Types

    Hasher interface

    Public Interface Hasher

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

    std/crypto/hashes.fb, line 26

    • 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.

    Md5 class

    Public Class Md5 Implements Hasher

    MD5's 16 bytes, only for checksums.

    std/crypto/hashes.fb, line 36

    • Public New() constructor #

      A new Md5, of nothing yet.

    • Public Static Method Hash(data: UInt8[]): UInt8[] static method #

      The MD5 of data.

    • Public Static Method Hash(text: String): UInt8[] static method #

      The MD5 of text's UTF-8 bytes.

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

      Adds data to what it hashes.

      Doc from std.crypto.hashes.Hasher.Add.

    • Public Method Add(text: String) method #

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

      Doc from std.crypto.hashes.Hasher.Add.

    • Public Method Finish(): UInt8[] method #

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

      Doc from std.crypto.hashes.Hasher.Finish.

    Sha1 class

    Public Class Sha1 Implements Hasher

    SHA-1's 20 bytes, only for checksums and the formats that ask for it, like Git's.

    std/crypto/hashes.fb, line 65

    • Public New() constructor #

      A new Sha1, of nothing yet.

    • Public Static Method Hash(data: UInt8[]): UInt8[] static method #

      The SHA-1 of data.

    • Public Static Method Hash(text: String): UInt8[] static method #

      The SHA-1 of text's UTF-8 bytes.

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

      Adds data to what it hashes.

      Doc from std.crypto.hashes.Hasher.Add.

    • Public Method Add(text: String) method #

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

      Doc from std.crypto.hashes.Hasher.Add.

    • Public Method Finish(): UInt8[] method #

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

      Doc from std.crypto.hashes.Hasher.Finish.

    Sha256 class

    Public Class Sha256 Implements Hasher

    SHA-256's 32 bytes.

    std/crypto/hashes.fb, line 94

    • Public New() constructor #

      A new Sha256, of nothing yet.

    • Public Static Method Hash(data: UInt8[]): UInt8[] static method #

      The SHA-256 of data.

    • Public Static Method Hash(text: String): UInt8[] static method #

      The SHA-256 of text's UTF-8 bytes.

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

      Adds data to what it hashes.

      Doc from std.crypto.hashes.Hasher.Add.

    • Public Method Add(text: String) method #

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

      Doc from std.crypto.hashes.Hasher.Add.

    • Public Method Finish(): UInt8[] method #

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

      Doc from std.crypto.hashes.Hasher.Finish.

    Sha512 class

    Public Class Sha512 Implements Hasher

    SHA-512's 64 bytes.

    std/crypto/hashes.fb, line 123

    • Public New() constructor #

      A new Sha512, of nothing yet.

    • Public Static Method Hash(data: UInt8[]): UInt8[] static method #

      The SHA-512 of data.

    • Public Static Method Hash(text: String): UInt8[] static method #

      The SHA-512 of text's UTF-8 bytes.

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

      Adds data to what it hashes.

      Doc from std.crypto.hashes.Hasher.Add.

    • Public Method Add(text: String) method #

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

      Doc from std.crypto.hashes.Hasher.Add.

    • Public Method Finish(): UInt8[] method #

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

      Doc from std.crypto.hashes.Hasher.Finish.

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