Dart API Referencedart:cryptoHash

Hash abstract class

Interface for cryptographic hash functions.

The update method is used to add data to the hash. The digest method is used to extract the message digest.

Once the digest method has been called no more data can be added using the update method. If update is called after the first call to digest a HashException is thrown.

If multiple instances of a given Hash is needed the newInstance method can provide a new instance.

abstract class Hash {
  /**
   * Add a list of bytes to the hash computation.
   */
  Hash update(List<int> data);

  /**
   * Finish the hash computation and extract the message digest as
   * a list of bytes.
   */
  List<int> digest();

  /**
   * Returns a new instance of this hash function.
   */
  Hash newInstance();

  /**
   * Block size of the hash in bytes.
   */
  int get blockSize;
}

Subclasses

MD5, SHA1, SHA256

Properties

final int blockSize #

Block size of the hash in bytes.

int get blockSize;

Methods

List<int> digest() #

Finish the hash computation and extract the message digest as a list of bytes.

List<int> digest();

Hash newInstance() #

Returns a new instance of this hash function.

Hash newInstance();

Hash update(List<int> data) #

Add a list of bytes to the hash computation.

Hash update(List<int> data);