codec

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeParams

func DecodeParams(params string) (map[string]string, error)

func EncodeParams

func EncodeParams(params map[string]string) string

EncodeParams encodes a map of parameters into a string. It sorts the keys to ensure a consistent output string.

func MergeParams added in v1.1.0

func MergeParams(sources string, params map[string]string) string

Types

type Codec

type Codec interface {
	Encoder
	Decoder
	Version
}

codec defines the interface for hash encoding and decoding operations

func NewCodec

func NewCodec(opts ...Option) Codec

NewCodec creates a new codec

type Decoder added in v1.1.0

type Decoder interface {
	// Decode decodes a string into hash parts
	Decode(encoded string) (*types.HashParts, error)
}

Decoder defines the interface for hash decoding operations

type Encoder added in v1.1.0

type Encoder interface {
	// Encode encodes salt and hash into a string
	Encode(parts *types.HashParts) (string, error)
}

Encoder defines the interface for hash encoding operations

type Option

type Option func(*codec)

Option defines configuration options for the codec

func WithVersion

func WithVersion(version string) Option

WithVersion sets the version number

type Version added in v1.1.0

type Version interface {
	// Version returns the version of the codec
	Version() string
}

Version defines the interface for version operations

Jump to

Keyboard shortcuts

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