OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/base64url.h" | 5 #include "base/base64url.h" |
6 | 6 |
| 7 #include <stddef.h> |
| 8 |
7 #include "base/base64.h" | 9 #include "base/base64.h" |
| 10 #include "base/macros.h" |
8 #include "base/numerics/safe_math.h" | 11 #include "base/numerics/safe_math.h" |
9 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
10 #include "third_party/modp_b64/modp_b64.h" | 13 #include "third_party/modp_b64/modp_b64.h" |
11 | 14 |
12 namespace base { | 15 namespace base { |
13 | 16 |
14 const char kPaddingChar = '='; | 17 const char kPaddingChar = '='; |
15 | 18 |
16 // Base64url maps {+, /} to {-, _} in order for the encoded content to be safe | 19 // Base64url maps {+, /} to {-, _} in order for the encoded content to be safe |
17 // to use in a URL. These characters will be translated by this implementation. | 20 // to use in a URL. These characters will be translated by this implementation. |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 // Append the necessary padding characters. | 92 // Append the necessary padding characters. |
90 base64_input.resize(base64_input_size.ValueOrDie(), '='); | 93 base64_input.resize(base64_input_size.ValueOrDie(), '='); |
91 | 94 |
92 return Base64Decode(base64_input, output); | 95 return Base64Decode(base64_input, output); |
93 } | 96 } |
94 | 97 |
95 return Base64Decode(input, output); | 98 return Base64Decode(input, output); |
96 } | 99 } |
97 | 100 |
98 } // namespace base | 101 } // namespace base |
OLD | NEW |