hash

package
v0.3.11 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NormalizeChecksum added in v0.3.4

func NormalizeChecksum(raw string) string

NormalizeChecksum trims whitespace and an optional sha256: prefix.

func NormalizeOid added in v0.3.4

func NormalizeOid(oid string) string

NormalizeOid strips an optional "sha256:" prefix, lowercases, and validates that the result is a 64-character hex string. Returns "" for invalid input.

Types

type ChecksumType

type ChecksumType string

ChecksumType represents the digest method used to create the checksum

const (
	ChecksumTypeSHA1     ChecksumType = "sha1"
	ChecksumTypeSHA256   ChecksumType = "sha256"
	ChecksumTypeSHA512   ChecksumType = "sha512"
	ChecksumTypeMD5      ChecksumType = "md5"
	ChecksumTypeETag     ChecksumType = "etag"
	ChecksumTypeCRC32C   ChecksumType = "crc32c"
	ChecksumTypeTrunc512 ChecksumType = "trunc512"
)

IANA Named Information Hash Algorithm Registry values and other common types

func NormalizeChecksumType

func NormalizeChecksumType(raw string) ChecksumType

func (ChecksumType) String

func (ct ChecksumType) String() string

type HashInfo

type HashInfo struct {
	MD5    string `json:"md5,omitempty"`
	SHA    string `json:"sha,omitempty"`
	SHA256 string `json:"sha256,omitempty"`
	SHA512 string `json:"sha512,omitempty"`
	CRC    string `json:"crc,omitempty"`
	ETag   string `json:"etag,omitempty"`
}

func ConvertDrsChecksumsToHashInfo

func ConvertDrsChecksumsToHashInfo(checksums []drsapi.Checksum) HashInfo

func (*HashInfo) UnmarshalJSON

func (h *HashInfo) UnmarshalJSON(data []byte) error

UnmarshalJSON accepts both the DRS map-based schema (Indexd) and the array-of-checksums schema (GA4GH).

Jump to

Keyboard shortcuts

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