WebSafeBase64Decode golang (adapter zplay doubleclick )
func base64url_decode(s string) ([]byte, error) { base64Str := strings.Map(func(r rune) rune { switch r { case ‘-‘: return ‘+‘ case ‘_‘: return ‘/‘ } return r }, s) if pad := len(base64Str) % 4; pad > 0 { base64Str += strings.Repeat("=", 4-pad) } return base64.StdEncoding.DecodeString(base64Str) }
时间: 2024-10-19 07:40:51