Interfaces

interface Digest

public interface Digest {
    prop size: Int64
    prop blockSize: Int64
    prop algorithm: String
    func write(buffer: Array<Byte>): Unit
    func finish(to!: Array<Byte>): Unit
    func finish(): Array<Byte>
    func reset(): Unit
}

Description: Specifies a digest algorithm interface. Any class, interface, and struct inherited from this interface must comply with the definitions of the input parameters and return values of the functions in this interface.

prop algorithm

prop algorithm: String

Description: Obtains the name of the digest algorithm.

Type: String

prop blockSize

prop blockSize: Int64

Description: Returns the Block size, in bytes.

Type: Int64

prop size

prop size: Int64

Description: Returns the size of the generated digest, in bytes.

Type: Int64

func finish()

func finish(): Array<Byte>

Description: Returns the generated digest value.

Returns:

func finish(Array<Byte>)

func finish(to!: Array<Byte>): Unit

Description: Obtains the generated digest value. Note that digest calculation cannot be performed after finish is called. If recalculation is required, reset the context.

Parameters:

func reset()

func reset(): Unit

Description: Resets the digest object to the initial state.

func write(Array<Byte>)

func write(buffer: Array<Byte>): Unit

Description: Updates the digest object using a specified buffer.