Skip to content

Commit

Permalink
increase DecodedLen
Browse files Browse the repository at this point in the history
  • Loading branch information
IncSW committed Aug 25, 2021
1 parent b0a5b39 commit 4299594
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions base64.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,14 @@ func (e *Encoding) EncodeStringToString(src string) string {
}

func (e *Encoding) DecodedLen(n int) int {
sf := 0
if n > 4 {
sf++
}
if !e.pad {
return n * 6 / 8
return n*6/8 + sf
}
return n / 4 * 3
return n/4*3 + sf
}

func (e *Encoding) Decode(dst []byte, src []byte) (int, error) {
Expand Down

0 comments on commit 4299594

Please sign in to comment.