import { __commonJS } from "../../../_virtual/rolldown_runtime.mjs";
import { require_forge } from "./forge.mjs";
import { require_util } from "./util.mjs";

//#region ../../node_modules/node-forge/lib/mgf1.js
var require_mgf1 = /* @__PURE__ */ __commonJS({ "../../node_modules/node-forge/lib/mgf1.js": ((exports, module) => {
	/**
	* Javascript implementation of mask generation function MGF1.
	*
	* @author Stefan Siegl
	* @author Dave Longley
	*
	* Copyright (c) 2012 Stefan Siegl <stesie@brokenpipe.de>
	* Copyright (c) 2014 Digital Bazaar, Inc.
	*/
	var forge = require_forge();
	require_util();
	forge.mgf = forge.mgf || {};
	var mgf1 = module.exports = forge.mgf.mgf1 = forge.mgf1 = forge.mgf1 || {};
	/**
	* Creates a MGF1 mask generation function object.
	*
	* @param md the message digest API to use (eg: forge.md.sha1.create()).
	*
	* @return a mask generation function object.
	*/
	mgf1.create = function(md) {
		return { generate: function(seed, maskLen) {
			var t = new forge.util.ByteBuffer();
			var len = Math.ceil(maskLen / md.digestLength);
			for (var i = 0; i < len; i++) {
				var c = new forge.util.ByteBuffer();
				c.putInt32(i);
				md.start();
				md.update(seed + c.getBytes());
				t.putBuffer(md.digest());
			}
			t.truncate(t.length() - maskLen);
			return t.getBytes();
		} };
	};
}) });

//#endregion
export default require_mgf1();

export { require_mgf1 };
//# sourceMappingURL=mgf1.mjs.map