Checksum

The Checksum registry offers functions to generate and verify checksums, ensuring data integrity. It supports various algorithms for reliable error detection and data validation.

You can easily import all the functions from the checksum registry by including the following import statement in your code

import "github.com/go-sprout/sprout/registry/checksum"

sha1sum

Sha1sum calculates the SHA-1 hash of the input string and returns it as a hexadecimal encoded string.

Signature

SHA1Sum(input string) string

Must version

{{ sha1sum "" }} // Output: da39a3ee5e6b4b0d3255bfef95601890afd80709
{{ sha1sum "Hello, World!" }} // Output: 0a0a9f2a6772942557ab5355d76af442f8f65e01

sha256sum

Sha256sum calculates the SHA-256 hash of the input string and returns it as a hexadecimal encoded string.

Signature

SHA256Sum(input string) string

Must version

{{ sha256sum "" }} // Output: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
{{ sha256sum "Hello, World!" }} // Output: dffd6021bb2bd5b0af676290809ec3a53191dd81c7f70a4b28688a362182986f

adler32sum

Adler32sum calculates the Adler-32 checksum of the input string and returns it as a hexadecimal encoded string.

Signature

Adler32Sum(input string) string

Must version

{{ adler32sum "" }} // Output: 00000001
{{ adler32sum "Hello, World!" }} // Output: 1f9e046a

md5sum

Md5sum calculates the MD5 hash of the input string and returns it as a hexadecimal encoded string.

Signature

MD5Sum(input string) string

Must version

{{ md5sum "" }} // Output: d41d8cd98f00b204e9800998ecf8427e
{{ md5sum "Hello, World!" }} // Output: 65a8e27d8879283831b664bd8b7f0ad4

Last updated

#18: v0.5 loaders with handlers and registries

Change request updated