// Package phcformat implements PHC string format parser and encoder. // // See https://github.com/P-H-C/phc-string-format
package phcformat import ( ) // Hash represents a hash function in PHC string format. type Hash struct { // ID is the symbolic name for the function. The function symbolic name // is a sequence of characters in: [a-z0-9-] (lowercase letters, digits, // and the minus sign). No other characters are allowed. A name must not // exceed 32 characters in length. Note that it is allowed to be empty. ID string // Version is the algorithm version. The function version is a sequence // of characters in: [0-9]. Note that it is allowed to be empty. // prohibited) Version option.Of[string] // Params is a comma-separated sequence of "key=value" parameter pairs. Params option.Of[string] // Salt is an encoded salt string. Salt option.Of[string] // Output is the base64-encoded function output. Output option.Of[string] // Raw is the unparsed hash in PHC string format. Raw string } // String implements the fmt.Stringer interface. It returns the hash in PHC // string format. func ( Hash) () string { return string(.Raw) } func ( byte) bool { return 'a' <= && <= 'z' || '0' <= && <= '9' || == '-' } func ( byte) bool { return '0' <= && <= '9' } func ( byte) bool { return 'a' <= && <= 'z' || '0' <= && <= '9' || == '-' } func ( byte) bool { return 'a' <= && <= 'z' || 'A' <= && <= 'Z' || '0' <= && <= '9' || == '/' || == '+' || == '.' || == '-' } func ( byte) bool { return 'a' <= && <= 'z' || 'A' <= && <= 'Z' || '0' <= && <= '9' || == '/' || == '+' || == '.' || == '-' } func ( byte) bool { return 'A' <= && <= 'Z' || 'a' <= && <= 'z' || '0' <= && <= '9' || == '+' || == '/' }