Documentation
¶
Overview ¶
Package opsutil holds helpers shared by several operations and engines that belong to no one domain.
Index ¶
- func BytesAsLatin1(b []byte) string
- func BytesAsText(data []byte) string
- func ChiSquaredCDF(x, k float64) float64
- func EscapeHTML(s string) string
- func EscapeWhitespace(s string) string
- func ExpandAlphRange(alph string) string
- func ParseEscapedChars(s string) string
- func SplitTopLevel(s string, sep byte) []string
- func TextAsBytes(s string) []byte
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BytesAsLatin1 ¶
BytesAsLatin1 maps each byte to its code point, matching CyberChef's Utils.byteArrayToChars. Unlike BytesAsText it never tries UTF-8 first.
func BytesAsText ¶
BytesAsText reads bytes as CyberChef reads a dish: as UTF-8 where that works, and otherwise one character per byte, so a byte that is not valid UTF-8 keeps its value instead of becoming U+FFFD.
func ChiSquaredCDF ¶
ChiSquaredCDF returns the probability that a chi-squared variable with k degrees of freedom is at most x.
func EscapeHTML ¶
EscapeHTML escapes HTML-significant characters the way CyberChef's Utils.escapeHtml does.
func EscapeWhitespace ¶
EscapeWhitespace maps control characters 0x09–0x10 into the Private Use Area (0xE000 + code) so they render, matching Utils.EscapeWhitespace.
func ExpandAlphRange ¶
ExpandAlphRange expands an alphabet specification such as "A-Za-z0-9+/=" into its full character sequence. A backslash escapes a literal dash ("\\-").
func ParseEscapedChars ¶
ParseEscapedChars converts recognised backslash escape sequences into their literal characters. Unrecognised sequences (e.g. "\d") are left intact.
func SplitTopLevel ¶
SplitTopLevel splits s on sep, ignoring separators inside brackets, parentheses or quotes. Selector and path syntaxes both nest that way, so a naive split would cut a bracketed subexpression in half.
func TextAsBytes ¶
TextAsBytes writes text back out as CyberChef writes it: one byte per character while every character fits in a byte, and the whole string as UTF-8 as soon as one does not. It is the inverse of BytesAsText, and what decides whether charcode 255 leaves as the byte 0xFF or as its UTF-8 form.
Types ¶
This section is empty.