package main import ( "fmt" ) type Encipher func(plaintext string) string func main() { p := "123" s := GenEncryptionFunc(Test) fmt.Println(s(p)) } func GenEncryptionFunc(encrypt Encipher) func(string) (ciphertext string) { return func(plaintext string) string { return fmt.Sprintf("%s", encrypt(plaintext)) } } func Test(s string) string { return s + "321" }
时间: 2024-10-12 11:57:20