NewNameEncoding creates a NameEncoding from a string
(s string)
| 154 | |
| 155 | // NewNameEncoding creates a NameEncoding from a string |
| 156 | func NewNameEncoding(s string) (enc fileNameEncoding, err error) { |
| 157 | s = strings.ToLower(s) |
| 158 | switch s { |
| 159 | case "base32": |
| 160 | enc = caseInsensitiveBase32Encoding{} |
| 161 | case "base64": |
| 162 | enc = base64.RawURLEncoding |
| 163 | case "base32768": |
| 164 | enc = base32768.SafeEncoding |
| 165 | default: |
| 166 | err = fmt.Errorf("unknown file name encoding mode %q", s) |
| 167 | } |
| 168 | return enc, err |
| 169 | } |
| 170 | |
| 171 | // Cipher defines an encoding and decoding cipher for the crypt backend |
| 172 | type Cipher struct { |
searching dependent graphs…