1.13 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.hexToBase64 = void 0;
4/*
5 * Copyright The OpenTelemetry Authors
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * https://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 */
19function hexToBase64(hexStr) {
20 const hexStrLen = hexStr.length;
21 let hexAsciiCharsStr = '';
22 for (let i = 0; i < hexStrLen; i += 2) {
23 const hexPair = hexStr.substring(i, i + 2);
24 const hexVal = parseInt(hexPair, 16);
25 hexAsciiCharsStr += String.fromCharCode(hexVal);
26 }
27 return btoa(hexAsciiCharsStr);
28}
29exports.hexToBase64 = hexToBase64;
30//# sourceMappingURL=hex-to-base64.js.map
\No newline at end of file