php的des-ecb加密,go中如何解密?麻烦各位大佬赐教

TonyHappyStyle · · 1242 次点击
``` <?php $key = '12345678'; $data = 'adsdfasfd'; $str = openssl_encrypt ($data, 'des-ecb', $key); var_dump($str); // string(24) "WHIttCXTRINe86ptkV8eQw==" ``` ``` package main import ( "encoding/base64" "fmt" "log" "github.com/forgoer/openssl" ) func main() { key := "12345678" data := "WHIttCXTRINe86ptkV8eQw==" decodeString, err := base64.StdEncoding.DecodeString(data) if err != nil { log.Fatalln("base64 decode失败,", err) } decrypt, err := openssl.DesECBDecrypt([]byte(decodeString), []byte(key), openssl.PKCS7_PADDING) if err != nil { log.Fatalln("解密失败,", err) } fmt.Println(string(decrypt)) } // adsdfasfd ``` 好好学习,积累工作经验
#1
更多评论
``` <?php $key = '12345678'; $data = 'adsdfasfd'; $str = openssl_encrypt ($data, 'des-ecb', $key); var_dump($str); ``` string(24) "WHIttCXTRINe86ptkV8eQw=="
#2