hashlib

package
v0.0.16 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 13, 2024 License: MIT Imports: 11 Imported by: 0

README

HashLib

hashlib defines hash primitives for Starlark.

Functions

md5(data) string

Returns an MD5 hash for a string or bytes.

Examples

Basic

Calculate an MD5 checksum for "hello world".

load("hashlib", "md5")
sum = md5("hello world!")
print(sum)
# Output: fc3ff98e8c6a0d3087d515c0473f8677
sha1(data) string

Returns a SHA-1 hash for a string or bytes.

Examples

Basic

Calculate an SHA-1 checksum for "hello world".

load("hashlib", "sha1")
sum = sha1("hello world!")
print(sum)
# Output: 430ce34d020724ed75a196dfc2ad67c77772d169
sha256(data) string

Returns an SHA-256 hash for a string or bytes.

Examples

Basic

Calculate an SHA-256 checksum for "hello world".

load("hashlib", "sha256")
sum = sha256("hello world!")
print(sum)
# Output: 7509e5bda0c762d2bac7f90d758b5b2263fa01ccbc542ab5e3df163be08e6ca9
sha512(data) string

Returns an SHA-512 hash for a string or bytes.

Examples

Basic

Calculate an SHA-512 checksum for "hello world".

load("hashlib", "sha512")
sum = sha512("hello world!")
print(sum)
# Output: db9b1cd3262dee37756a09b9064973589847caa8e53d31a9d142ea2701b1b28abd97838bb9a27068ba305dc8d04a45a1fcf079de54d607666996b3cc54f6b67c

Documentation

Overview

Package hashlib defines hash primitives for Starlark.

Migrated from: https://github.com/qri-io/starlib/tree/master/hash

Index

Constants

View Source
const ModuleName = "hashlib"

ModuleName defines the expected name for this Module when used in starlark's load() function, eg: load('hashlib', 'md5')

Variables

This section is empty.

Functions

func LoadModule

func LoadModule() (starlark.StringDict, error)

LoadModule loads the hashlib module. It is concurrency-safe and idempotent.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL