scripthash

package
v1.168.0 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: Apache-2.0 Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package scripthash is the hashing a managed script is given, as a Starlark module (#2049).

It is separate from the engine for the reason internal/scriptdate is: every function is a pure transformation of its arguments, there is no run, no caller and no state, and the engine's only use of it is to predeclare the module. A digest is deterministic, so a recorded run replays with nothing recorded for it.

Index

Constants

View Source
const Name = "hash"

Name is the global the module is bound to.

Variables

View Source
var Module = &module{members: starlark.StringDict{
	"md5":         digestBuiltin("md5", md5.New),
	"sha1":        digestBuiltin("sha1", sha1.New),
	"sha256":      digestBuiltin("sha256", sha256.New),
	"sha512":      digestBuiltin("sha512", sha512.New),
	"hmac_sha1":   hmacBuiltin("hmac_sha1", sha1.New),
	"hmac_sha256": hmacBuiltin("hmac_sha256", sha256.New),
	"hmac_sha512": hmacBuiltin("hmac_sha512", sha512.New),
	"crc32":       starlark.NewBuiltin(Name+".crc32", crc32Fn),
	"fnv64":       starlark.NewBuiltin(Name+".fnv64", fnv64Fn),
}}

Module is the hash module the engine predeclares.

Every digest is computed in Go, so hashing a value costs one step whatever its length: an MD5 written in Starlark spends a step per operation and a megabyte page alone exhausts a run's step budget.

The module is also callable. Starlark's universe has hash(x), and the module takes its name, so hash("abc") keeps returning what the universe's hash returned before the module existed.

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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