operatorpw

package
v0.0.0-...-16aca47 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2026 License: GPL-2.0, GPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package operatorpw normalizes operator password file contents so the server and sablectl agree on what the password is, even when the file was written with a UTF-16 BOM (PowerShell's default) or other Windows-friendly encodings.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Normalize

func Normalize(data []byte) string

Normalize returns the trimmed, decoded password from the raw bytes of a password file. It strips UTF-8/UTF-16 BOMs and decodes UTF-16 little- or big-endian content. Plain UTF-8 ASCII files are returned trimmed.

Order matters: BOMs are unambiguous and checked first. BOM-less UTF-16 is detected by null-byte heuristics before the utf8.Valid branch, because `s\x00e\x00...` is technically valid UTF-8 too — checking utf8.Valid first would mis-decode UTF-16 LE files written without a BOM.

Types

This section is empty.

Jump to

Keyboard shortcuts

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