• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1"use strict";
2/*
3 * Copyright (c) 2022-2025 Huawei Device Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16Object.defineProperty(exports, "__esModule", { value: true });
17exports.UniqueId = void 0;
18const sha1_1 = require("./sha1");
19class UniqueId {
20    constructor() {
21        this.sha = (0, sha1_1.createSha1)();
22    }
23    addString(data) {
24        this.sha.updateString(data);
25        return this;
26    }
27    addI32(data) {
28        this.sha.updateInt32(data);
29        return this;
30    }
31    addF32Array(data) {
32        this.sha.update(data);
33        return this;
34    }
35    addI32Array(data) {
36        this.sha.update(data);
37        return this;
38    }
39    addU32Array(data) {
40        this.sha.update(data);
41        return this;
42    }
43    addU8Array(data) {
44        this.sha.update(data);
45        return this;
46    }
47    addPtr(data) {
48        if (data instanceof Uint32Array) {
49            return this.addU32Array(data);
50        }
51        return this.addI32(data);
52    }
53    compute() {
54        return this.sha.digest("hex");
55    }
56}
57exports.UniqueId = UniqueId;
58//# sourceMappingURL=uniqueId.js.map