Standard library / crypto/des

crypto/des.KeySizeError

Obsolete cipher; never use for new security systems. Reports the invalid key length in bytes. Use errors.As to classify constructor failures rather than parsing the text. Expected stdout: 'true 0\n'.

Formal Syntax & Structure

go syntaxgo
type KeySizeError int

Working Example

Example Snippetgo
package main
import (  "crypto/des"  "errors"  "fmt")
func main() {  // Historical interoperability demonstration only. Never deploy this cipher/mode.  _, err := des.NewCipher(nil)  var k des.KeySizeError  fmt.Println(errors.As(err, &k), int(k))}func must[T any](v T, e error) T {  if e != nil {    panic(e)  }  return v}func check(e error) {  if e != nil {    panic(e)  }}
Go Reference