Search results

There are no results.

std.crypto.sha1

An implementation of the SHA1 hash function.

SHA1 is not cryptographically secure and you should avoid using it whenever possible.

Examples

import std.crypto.sha1 (Sha1)

let hasher = Sha1.new

hasher.write('hello'.to_byte_array)
hasher.finish.to_string # => 'aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d'

You can also use Sha1.hash:

import std.crypto.sha1 (Sha1)

Sha1.hash('hello'.to_byte_array).to_string # => 'aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d'

Limitations

The implementation of SHA1 uses a 64-bits signed integer for tracking the total message size in bytes. This limits the total message size to 1024 PiB.

Classes

Sha1

A SHA1 hasher.