Standard library / crypto/rc4

crypto/rc4.Cipher.Reset()

Deprecated: invalidates the cipher and attempts to clear internal key state but cannot ensure erasure of all key copies. RC4 is broken. Do not rely on Reset for secure memory wiping. Public fixed key for an isolated test vector only; do not use it to protect real data. Expected stdout: 'reset called\n'.

Formal Syntax & Structure

go syntaxgo
func (c *Cipher) Reset()

Working Example

Example Snippetgo
package main
import (  "crypto/rc4"  "fmt")
func main() {  // Historical interoperability demonstration only. Never deploy this cipher/mode.  c := must(rc4.NewCipher([]byte("Key")))  c.Reset()  fmt.Println("reset called")}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