utilgo.mau.fi/util/exstrings Index | Files

package exstrings

import "go.mau.fi/util/exstrings"

Index

Functions

func ConstantTimeEqual

func ConstantTimeEqual(a, b string) bool

ConstantTimeEqual compares two strings using subtle.ConstantTimeCompare without copying the strings.

Note that ConstantTimeCompare is not constant time if the strings are of different length.

func SHA256

func SHA256(str string) [32]byte

SHA256 returns the SHA-256 hash of the input string without copying the string.

func UnsafeBytes

func UnsafeBytes(str string) []byte

UnsafeBytes returns a byte slice that points to the same memory as the input string.

The returned byte slice must not be modified.

Source Files

stringutil.go

Version
v0.8.6 (latest)
Published
Mar 16, 2025
Platform
linux/amd64
Imports
3 packages
Last checked
1 week ago

Tools for package owners.