WebSafeBase64Decode
2021-07-08 15:05
标签:span pad des web bsp style lan dap pre WebSafeBase64Decode 标签:span pad des web bsp style lan dap pre 原文地址:http://www.cnblogs.com/lavin/p/7096445.htmlWebSafeBase64Decode 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)
}
文章标题:WebSafeBase64Decode
文章链接:http://soscw.com/index.php/essay/102402.html