django-vue3-admin-web/node_modules/@aws-crypto/sha256-browser/build/module/crossPlatformSha256.js
2025-10-20 21:21:14 +08:00

27 lines
933 B
JavaScript

import { Sha256 as WebCryptoSha256 } from "./webCryptoSha256";
import { Sha256 as JsSha256 } from "@aws-crypto/sha256-js";
import { supportsWebCrypto } from "@aws-crypto/supports-web-crypto";
import { locateWindow } from "@aws-sdk/util-locate-window";
import { convertToBuffer } from "@aws-crypto/util";
var Sha256 = /** @class */ (function () {
function Sha256(secret) {
if (supportsWebCrypto(locateWindow())) {
this.hash = new WebCryptoSha256(secret);
}
else {
this.hash = new JsSha256(secret);
}
}
Sha256.prototype.update = function (data, encoding) {
this.hash.update(convertToBuffer(data));
};
Sha256.prototype.digest = function () {
return this.hash.digest();
};
Sha256.prototype.reset = function () {
this.hash.reset();
};
return Sha256;
}());
export { Sha256 };
//# sourceMappingURL=crossPlatformSha256.js.map