Standard library / crypto/des
crypto/des.NewTripleDESCipher()
Legacy-only Triple DES with a 24-byte key; obsolete for new designs. Public fixed key for an isolated test vector only; do not use it to protect real data. Expected stdout: '8\n'.
Formal Syntax & Structure
go syntaxgo
func NewTripleDESCipher(key []byte) (cipher.Block, error)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| key | []byte | 24-byte Triple DES key. |
Return Value
(cipher.Block, error)
Block or invalid-key-length error.
Working Example
Example Snippetgo
package main
import ( "crypto/des" "fmt")
func main() { // Historical interoperability demonstration only. Never deploy this cipher/mode. b := must(des.NewTripleDESCipher(make([]byte, 24))) fmt.Println(b.BlockSize())}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) }}