Documentation
¶
Index ¶
- Variables
- func ConvertChecksumsToMap(checksums []Checksum) map[string]string
- func ConvertDrsChecksumsToMap(checksums []drsapi.Checksum) map[string]string
- func ConvertHashInfoToMap(hashes HashInfo) map[string]string
- func ConvertMapToDrsChecksums(hashes map[string]string) []drsapi.Checksum
- func ValidateChecksum(c Checksum) error
- type Checksum
- type ChecksumType
- type HashInfo
Constants ¶
This section is empty.
Variables ¶
View Source
var SupportedChecksums = map[string]bool{ string(ChecksumTypeSHA1): true, string(ChecksumTypeSHA256): true, string(ChecksumTypeSHA512): true, string(ChecksumTypeMD5): true, string(ChecksumTypeETag): true, string(ChecksumTypeCRC32C): true, string(ChecksumTypeTrunc512): true, }
Functions ¶
func ConvertChecksumsToMap ¶
func ConvertHashInfoToMap ¶
func ValidateChecksum ¶
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) IsValid ¶
func (ct ChecksumType) IsValid() bool
IsValid checks if the checksum type is a known/recommended value
func (ChecksumType) String ¶
func (ct ChecksumType) String() string
String returns the string representation of the checksum type
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 (*HashInfo) UnmarshalJSON ¶
UnmarshalJSON accepts both the DRS map-based schema (Indexd) and the array-of-checksums schema (GA4GH).
Click to show internal directories.
Click to hide internal directories.