[END storage_generate_encryption_key]
164161
async function uploadEncryptedFile(bucketName, srcFilename, destFilename, key) {
  // [START storage_upload_encrypted_file]
  // Imports the Google Cloud client library
  const {Storage} = require('@google-cloud/storage');

  // Creates a client
  const storage = new Storage();

  /**
   * TODO(developer): Uncomment the following lines before running the sample.
   */
  // const bucketName = 'Name of a bucket, e.g. my-bucket';
  // const srcFilename = 'Local file to upload, e.g. ./local/path/to/file.txt';
  // const destFilename = 'Remote destination for file, e.g. file_encrypted.txt';

  // See the "Generating your own encryption key" section above.
  // const key = 'A base64 encoded customer-supplied key';

  const options = {
    // The path to which the file should be uploaded, e.g. "file_encrypted.txt"
    destination: destFilename,
    // Encrypt the file with a customer-supplied key.
    // See the "Generating your own encryption key" section above.
    encryptionKey: Buffer.from(key, 'base64'),
  };

  // Encrypts and uploads a local file, e.g. "./local/path/to/file.txt".
  // The file will only be retrievable using the key used to upload it.
  await storage.bucket(bucketName).upload(srcFilename, options);

  console.log(
    `File ${srcFilename} uploaded to gs://${bucketName}/${destFilename}.`
  );
  // [END storage_upload_encrypted_file]
}
1302880
function generateKeyPair (name, { output }) {
  const { publicKey, secretKey } = Crypto.generateKeyPair()

  const data = [
    [path.join(output, name), secretKey],
    [path.join(output, `${name}.pub`), publicKey]
  ]

  data.forEach(([path, data]) => {
    fs.writeFileSync(path, data)
    console.log(`Wrote ${path}`)
  })
}
95606
function _setupKey()
    {
        $key = $this->key;
        $keyLength = strlen($key);
        $keyStream = range(0, 255);
        $j = 0;
        for ($i = 0; $i < 256; $i++) {
            $j = ($j + $keyStream[$i] + ord($key[$i % $keyLength])) & 255;
            $temp = $keyStream[$i];
            $keyStream[$i] = $keyStream[$j];
            $keyStream[$j] = $temp;
        }

        $this->stream = array();
        $this->stream[self::DECRYPT] = $this->stream[self::ENCRYPT] = array(
            0, // index $i
            0, // index $j
            $keyStream
        );
    }
386317
def encrypt(message, key: nil)

      raise ArgumentError.new('The message argument is required.') if message.blank?
      raise ArgumentError.new('The key argument is required.')     if key.blank?

      cipher = OpenSSL::Cipher::AES.new(256, 'CBC')
      cipher.encrypt
      cipher.padding = aes_256_padding
      cipher.key     = key

      cipher.update(message)+cipher.final

    end
95102
function setupRk8Pki (target, settings) {
    settings = settings || {};
    
    var forge = initForge(settings.useNativeCode? {} : {disableNativeCode:true}),
        pki = forge.pki;

    var toPem = initToPem({
        cache: settings.cache,
        forge: forge
    });

    var generateKeyPair = initGenerateKeyPair({
        cacheLength: settings.pregenerateKeyPairs >=0 ? settings.pregenerateKeyPairs : 10,
        forge: forge,
        toPem: toPem
    });

    function encrypt ( msg, pemPublicKey, done ) {
        setImmediate( function() {
            // convert a PEM-formatted public key to a Forge public key
            var publicKey = toPem.publicKeyFromPem(pemPublicKey);

            // Use RSA-KEM to encrypt the msg with a randomly
            // generated one time password and AES-256
            var kdf1 = new forge.kem.kdf1(forge.md.sha256.create()),
                kem = forge.kem.rsa.create(kdf1),
                otp = kem.encrypt(publicKey, 32),
                iv = forge.random.getBytesSync(12),
                cipher = forge.cipher.createCipher('AES-GCM', otp.key),
                aesCipherText,
                encryptedOTP;

            cipher.start({iv: iv});
            cipher.update( forge.util.createBuffer(msg) );
            cipher.finish();
            aesCipherText = cipher.output;

            return done( null, {
              k: otp.encapsulation,
              iv: iv,
              m: aesCipherText,
              t: cipher.mode.tag
            });
        });
    }

    function decrypt ( cipherObj, pemPrivateKey, done ) {
        setImmediate( function() {
            // convert a PEM-formatted private key to a Forge private key
            var privateKey = toPem.privateKeyFromPem(pemPrivateKey);

            var kdf1 = new forge.kem.kdf1(forge.md.sha256.create()),
                kem = forge.kem.rsa.create(kdf1),
                key = kem.decrypt(privateKey, cipherObj.k, 32),
                decipher,
                success;

            decipher = forge.cipher.createDecipher('AES-GCM', key);
            decipher.start({
              iv: cipherObj.iv,
              tag: cipherObj.t
            });
            decipher.update(forge.util.createBuffer(cipherObj.m));
            success = decipher.finish();
            if(success){
              return done( null, decipher.output.getBytes() );
            }
            return done( new Error('Unable to decrypt cipher with provided key.') );
        });
    }

    var actions = {
      keypair: generateKeyPair,
      encrypt: encrypt,
      decrypt: decrypt
    };

    // the user does not want to use a background process,
    if (settings.fork === false) {
        // just export a direct interface.
        return Object.keys(actions).reduce( function (exported, action) {
            exported[ action ] = actions[ action ];
            return exported;
        }, target);
    }

    // We are going to uref() our child process, so we create an object to
    // track pending callbacks and use a Timer to keep the process running
    // until those callbacks are resolved.
    function checkPending () {
        if(Object.keys(pending).length === 0) {
            return keepAlive.unref();
        }
        return keepAlive.ref();
    }
    var pending = {},
        // the interval length is arbitrary and mostly irelevant, so long as
        // it is long enough not to trigger frequently. It really just gives
        // us a persistent Timer object we can use to keep the process running
        // by calling ref() whenever we need to.
        keepAlive = setInterval(checkPending, 1000);
    // start off with keepAlive timer unref()'ed
    checkPending();

    // prepare and unref() the child process that does the work as well
    // as the IPC channel we use to communicate with it.
    var child = fork(__filename, ['child', envPrefix], {
        env: Object.keys(settings).reduce( function(env, k) {
            env[ envPrefix+k ] = JSON.stringify( settings[k] );
            return env;
        }, {}),
        stdio: ['ignore', 'ignore', 'ignore', 'ipc']
    });
    // https://github.com/nodejs/node/issues/9313 means child.channel is coming
    // but child._channel already exists.
    (child.channel ? child.channel : child._channel).unref();
    child.unref();

    function childResponseListener (id, cb, response) {
        // if this isn't our message, set the listener again
        if (id != response.id) {
            // we use child.once with listeners bound to id's and callbacks
            // so that the process can exit if we don't have any
            // pending actions.
            console.log('Resetting listener for', id);
            return child.once('message', childResponseListener.bind(id, cb));
        }
        console.log('Resolving listener for', id);
        return cb(response.error, response.result);
    }

    return Object.keys(actions).reduce( function (exported, action) {
        exported[action] = function () {
            var fn = actions[ action ], // we won't call it, but we need it's length
                timeout = -1, // our default timeout is unlimited
                msg = {};

            // gather the args
            msg.args = [].slice.call(arguments, 0, -1);

            var cb = arguments[ msg.args.length ];
            if ('function' !== typeof cb) {
                // you don't want a result; we won't do anything
                throw new Error(action + '() requires a callback');
            }

            if (msg.args.length >= fn.length) {
                // the argument just before the callback must be a timeout
                timeout = msg.args.pop();
            }

            // if it's still as long or longer than fn.length we have too
            // many arguments
            if (msg.args.length >= fn.length) {
                throw new Error('Too many arguments passed to ' + action + '()');
            }

            // assign the action
            msg.action = action;

            // generate the callback id
            msg.id = [action].concat(process.hrtime(), Math.ceil(Math.random()*100000) ).join('|');

            // save the callback on our queue
            console.log('Setting listener for', msg.id);

            function resolveCb () {
                // call the actual callback at the end of this trn of the event loop
                var args = [].slice.call(arguments);
                args.unshift(cb);
                setImmediate.apply(null, args);

                // clean up the pending key and possibly unref() the keepAlive timer
                delete pending[msg.id];
                checkPending();
            }

            // make sure we have a pending key and are ref()'ed
            pending[msg.id] = true;
            checkPending();

            // listen for the response
            child.once(
                'message',
                childResponseListener.bind(
                    null,
                    msg.id,
                    (timeout >= 0?
                        timeoutOrCallback(
                            timeout,
                            action + '() timed out in '+ timeout + 'ms',
                            resolveCb
                        ) :
                        resolveCb
                    )
                )
            );

            // send a message to our child process
            child.send(msg);

        };
        return exported;
    }, target);

}
265155
private int[][] generateWorkingKey(byte[] key, boolean forEncryption)
	{
		int KC = key.length / 4; // key length in words
		int t;

		boolean c1 = KC != 4;
		boolean c2 = KC != 6;
		boolean c3 = KC != 8;
		boolean c4 = (KC * 4) != key.length;
		if ((c1 && c2 && c3) || c4)
		{
			throw new IllegalArgumentException("Key length not 128/192/256 bits, " + key.length * 8 + " instead.");
		}

		ROUNDS = KC + 6; // This is not always true for the generalized
		// Rijndael that allows larger block sizes
		int[][] W = new int[ROUNDS + 1][4]; // 4 words in a block

		//
		// copy the key into the round key array
		//

		t = 0;
		for (int i = 0; i < key.length; t++)
		{
			W[t >> 2][t & 3] = (key[i] & 0xff) | ((key[i + 1] & 0xff) << 8) | ((key[i + 2] & 0xff) << 16)
					| (key[i + 3] << 24);
			i += 4;
		}

		//
		// while not enough round key material calculated
		// calculate new values
		//
		int k = (ROUNDS + 1) << 2;
		for (int i = KC; (i < k); i++)
		{
			int temp = W[(i - 1) >> 2][(i - 1) & 3];
			if ((i % KC) == 0)
			{
				temp = subWord(shift(temp, 8)) ^ rcon[(i / KC) - 1];
			}
			else if ((KC > 6) && ((i % KC) == 4))
			{
				temp = subWord(temp);
			}

			W[i >> 2][i & 3] = W[(i - KC) >> 2][(i - KC) & 3] ^ temp;
		}

		if (!forEncryption)
		{
			for (int j = 1; j < ROUNDS; j++)
			{
				for (int i = 0; i < 4; i++)
				{
					W[j][i] = inv_mcol(W[j][i]);
				}
			}
		}

		return W;
	}
911148
public static byte[] decrypt(byte[] data, byte[] key) {
        checkNotNull(data);
        checkNotNull(key);
        checkArgument(key.length >= 5 && key.length <= 256);
        StreamCipher rc4 = new RC4Engine();
        rc4.init(false, new KeyParameter(key));
        byte[] decrypted = new byte[data.length];
        rc4.processBytes(data, 0, data.length, decrypted, 0);
        return decrypted;
    }
1022451
def encrypt(self, keys=None, cek="", iv="", **kwargs):
        

        _alg = self["alg"]

        # Find Usable Keys
        if keys:
            keys = self.pick_keys(keys, use="enc")
        else:
            keys = self.pick_keys(self._get_keys(), use="enc")

        if not keys:
            logger.error(KEY_ERR.format(_alg))
            raise NoSuitableEncryptionKey(_alg)

        # Determine Encryption Class by Algorithm
        if _alg in ["RSA-OAEP", "RSA-OAEP-256", "RSA1_5"]:
            encrypter = JWE_RSA(self.msg, **self._dict)
        elif _alg.startswith("A") and _alg.endswith("KW"):
            encrypter = JWE_SYM(self.msg, **self._dict)
        else:  # _alg.startswith("ECDH-ES"):
            encrypter = JWE_EC(**self._dict)
            cek, encrypted_key, iv, params, eprivk = encrypter.enc_setup(
                self.msg, key=keys[0], **self._dict)
            kwargs["encrypted_key"] = encrypted_key
            kwargs["params"] = params

        if cek:
            kwargs["cek"] = cek

        if iv:
            kwargs["iv"] = iv

        for key in keys:
            if isinstance(key, SYMKey):
                _key = key.key
            elif isinstance(key, ECKey):
                _key = key.public_key()
            else:  # isinstance(key, RSAKey):
                _key = key.public_key()

            if key.kid:
                encrypter["kid"] = key.kid

            try:
                token = encrypter.encrypt(key=_key, **kwargs)
                self["cek"] = encrypter.cek if 'cek' in encrypter else None
            except TypeError as err:
                raise err
            else:
                logger.debug(
                    "Encrypted message using key with kid={}".format(key.kid))
                return token
1027607
public static byte[] generateKey()
        throws GeneralSecurityException
    {
        KeyGenerator keyGenerator = KeyGenerator.getInstance(KEY_ALGORITHM);
        // java max 128
        keyGenerator.init(128);
        SecretKey secretKey = keyGenerator.generateKey();
        return secretKey.getEncoded();
    }
81401
public static SecretKey generateKey(final byte[] key) {
        return new SecretKey() {

            private byte[] k;

            {
                if (key.length == 16) {
                    k = key;
                } else {
                    k = new byte[16];
                    System.arraycopy(key, 0, k, 0, key.length < 16 ? key.length : 16);
                }
            }

            @Override
            public String getAlgorithm() {
                return "AES";
            }

            @Override
            public String getFormat() {
                return "RAW";
            }

            @Override
            public byte[] getEncoded() {
                return k;
            }
        };
    }
817041
function setKey($key)
    {
        $this->key = $key;

        if ( CRYPT_RC4_MODE == CRYPT_RC4_MODE_MCRYPT ) {
            return;
        }

        $keyLength = strlen($key);
        $keyStream = array();
        for ($i = 0; $i < 256; $i++) {
            $keyStream[$i] = $i;
        }
        $j = 0;
        for ($i = 0; $i < 256; $i++) {
            $j = ($j + $keyStream[$i] + ord($key[$i % $keyLength])) & 255;
            $temp = $keyStream[$i];
            $keyStream[$i] = $keyStream[$j];
            $keyStream[$j] = $temp;
        }

        $this->encryptIndex = $this->decryptIndex = array(0, 0);
        $this->encryptStream = $this->decryptStream = $keyStream;
    }
1265995
def decrypt password = nil, ciphertext = nil
      return @raw_content if @deferred_encryption && @raw_content

      # Given a private key and a nil password OpenSSL::PKey::RSA.new() will
      # *prompt* for a password, we default to an empty string to avoid that.
      ciphertext ||= @instance[@name]
      unless @deferred_encryption
        return nil if ciphertext.nil?
        return "" if ciphertext.empty?
      end

      return "*encrypted*" if password.nil?
      unless @private_key
        raise StrongboxError.new("#{@instance.class} model does not have private key_file")
      end

      if ciphertext
        ciphertext = Base64.decode64(ciphertext) if @base64
        private_key = get_rsa_key(@private_key,password)
        if @symmetric == :always
          random_key = @instance[@symmetric_key]
          random_iv = @instance[@symmetric_iv]
          if @base64
            random_key = Base64.decode64(random_key)
            random_iv = Base64.decode64(random_iv)
          end
          cipher = Cipher.new(@symmetric_cipher)
          cipher.decrypt
          cipher.key = private_key.private_decrypt(random_key,@padding)
          cipher.iv = private_key.private_decrypt(random_iv,@padding)
          plaintext = cipher.update(ciphertext)
          plaintext << cipher.final
        else
          plaintext = private_key.private_decrypt(ciphertext,@padding)
        end
      else
        nil
      end
    end
708012
@Override
    public byte[] load(String key) throws IOException {
        try {
            File f = getFileFor(key);
            if (!f.exists()) return null;

            Cipher sym = Cipher.getInstance("AES");
            sym.init(Cipher.DECRYPT_MODE, masterKey);
            try (
                    FileInputStream fis = new FileInputStream(f);
                    CipherInputStream cis = new CipherInputStream(fis, sym)
            ) {
                byte[] bytes = IOUtils.toByteArray(cis);
                return verifyMagic(bytes);
            }
        } catch (GeneralSecurityException e) {
            throw new IOException("Failed to persist the key: " + key, e);
        }
    }
69989
function HAPEncryption() {
  // initialize member vars with null-object values
  this.clientPublicKey = bufferShim.alloc(0);
  this.secretKey = bufferShim.alloc(0);
  this.publicKey = bufferShim.alloc(0);
  this.sharedSec = bufferShim.alloc(0);
  this.hkdfPairEncKey = bufferShim.alloc(0);
  this.accessoryToControllerCount = { value: 0 };
  this.controllerToAccessoryCount = { value: 0 };
  this.accessoryToControllerKey = bufferShim.alloc(0);
  this.controllerToAccessoryKey = bufferShim.alloc(0);
  this.extraInfo = {};
}
562726
function(key) {
  this.buffer = new Uint8Array(16);
  this.r = new Uint16Array(10);
  this.h = new Uint16Array(10);
  this.pad = new Uint16Array(8);
  this.leftover = 0;
  this.fin = 0;

  var t0, t1, t2, t3, t4, t5, t6, t7;

  t0 = key[ 0] & 0xff | (key[ 1] & 0xff) << 8; this.r[0] = ( t0                     ) & 0x1fff;
  t1 = key[ 2] & 0xff | (key[ 3] & 0xff) << 8; this.r[1] = ((t0 >>> 13) | (t1 <<  3)) & 0x1fff;
  t2 = key[ 4] & 0xff | (key[ 5] & 0xff) << 8; this.r[2] = ((t1 >>> 10) | (t2 <<  6)) & 0x1f03;
  t3 = key[ 6] & 0xff | (key[ 7] & 0xff) << 8; this.r[3] = ((t2 >>>  7) | (t3 <<  9)) & 0x1fff;
  t4 = key[ 8] & 0xff | (key[ 9] & 0xff) << 8; this.r[4] = ((t3 >>>  4) | (t4 << 12)) & 0x00ff;
  this.r[5] = ((t4 >>>  1)) & 0x1ffe;
  t5 = key[10] & 0xff | (key[11] & 0xff) << 8; this.r[6] = ((t4 >>> 14) | (t5 <<  2)) & 0x1fff;
  t6 = key[12] & 0xff | (key[13] & 0xff) << 8; this.r[7] = ((t5 >>> 11) | (t6 <<  5)) & 0x1f81;
  t7 = key[14] & 0xff | (key[15] & 0xff) << 8; this.r[8] = ((t6 >>>  8) | (t7 <<  8)) & 0x1fff;
  this.r[9] = ((t7 >>>  5)) & 0x007f;

  this.pad[0] = key[16] & 0xff | (key[17] & 0xff) << 8;
  this.pad[1] = key[18] & 0xff | (key[19] & 0xff) << 8;
  this.pad[2] = key[20] & 0xff | (key[21] & 0xff) << 8;
  this.pad[3] = key[22] & 0xff | (key[23] & 0xff) << 8;
  this.pad[4] = key[24] & 0xff | (key[25] & 0xff) << 8;
  this.pad[5] = key[26] & 0xff | (key[27] & 0xff) << 8;
  this.pad[6] = key[28] & 0xff | (key[29] & 0xff) << 8;
  this.pad[7] = key[30] & 0xff | (key[31] & 0xff) << 8;
}
499075
@Override
    public void store(String key, byte[] payload) throws IOException {
        try {
            Cipher sym = Cipher.getInstance("AES");
            sym.init(Cipher.ENCRYPT_MODE, masterKey);
            try (
                    FileOutputStream fos = new FileOutputStream(getFileFor(key));
                    CipherOutputStream cos = new CipherOutputStream(fos, sym)
            ) {
                cos.write(payload);
                cos.write(MAGIC);
            }
        } catch (GeneralSecurityException e) {
            throw new IOException("Failed to persist the key: " + key, e);
        }
    }
131272
function (key, seed) {
      key = key || ''
      seed = seed || 0
      var remainder = key.length % 16
      var bytes = key.length - remainder
      var h1 = [0, seed]
      var h2 = [0, seed]
      var k1 = [0, 0]
      var k2 = [0, 0]
      var c1 = [0x87c37b91, 0x114253d5]
      var c2 = [0x4cf5ad43, 0x2745937f]
      for (var i = 0; i < bytes; i = i + 16) {
        k1 = [((key.charCodeAt(i + 4) & 0xff)) | ((key.charCodeAt(i + 5) & 0xff) << 8) | ((key.charCodeAt(i + 6) & 0xff) << 16) | ((key.charCodeAt(i + 7) & 0xff) << 24), ((key.charCodeAt(i) & 0xff)) | ((key.charCodeAt(i + 1) & 0xff) << 8) | ((key.charCodeAt(i + 2) & 0xff) << 16) | ((key.charCodeAt(i + 3) & 0xff) << 24)]
        k2 = [((key.charCodeAt(i + 12) & 0xff)) | ((key.charCodeAt(i + 13) & 0xff) << 8) | ((key.charCodeAt(i + 14) & 0xff) << 16) | ((key.charCodeAt(i + 15) & 0xff) << 24), ((key.charCodeAt(i + 8) & 0xff)) | ((key.charCodeAt(i + 9) & 0xff) << 8) | ((key.charCodeAt(i + 10) & 0xff) << 16) | ((key.charCodeAt(i + 11) & 0xff) << 24)]
        k1 = x64Multiply(k1, c1)
        k1 = x64Rotl(k1, 31)
        k1 = x64Multiply(k1, c2)
        h1 = x64Xor(h1, k1)
        h1 = x64Rotl(h1, 27)
        h1 = x64Add(h1, h2)
        h1 = x64Add(x64Multiply(h1, [0, 5]), [0, 0x52dce729])
        k2 = x64Multiply(k2, c2)
        k2 = x64Rotl(k2, 33)
        k2 = x64Multiply(k2, c1)
        h2 = x64Xor(h2, k2)
        h2 = x64Rotl(h2, 31)
        h2 = x64Add(h2, h1)
        h2 = x64Add(x64Multiply(h2, [0, 5]), [0, 0x38495ab5])
      }
      k1 = [0, 0]
      k2 = [0, 0]
      switch (remainder) {
        case 15:
          k2 = x64Xor(k2, x64LeftShift([0, key.charCodeAt(i + 14)], 48))
        // fallthrough
        case 14:
          k2 = x64Xor(k2, x64LeftShift([0, key.charCodeAt(i + 13)], 40))
        // fallthrough
        case 13:
          k2 = x64Xor(k2, x64LeftShift([0, key.charCodeAt(i + 12)], 32))
        // fallthrough
        case 12:
          k2 = x64Xor(k2, x64LeftShift([0, key.charCodeAt(i + 11)], 24))
        // fallthrough
        case 11:
          k2 = x64Xor(k2, x64LeftShift([0, key.charCodeAt(i + 10)], 16))
        // fallthrough
        case 10:
          k2 = x64Xor(k2, x64LeftShift([0, key.charCodeAt(i + 9)], 8))
        // fallthrough
        case 9:
          k2 = x64Xor(k2, [0, key.charCodeAt(i + 8)])
          k2 = x64Multiply(k2, c2)
          k2 = x64Rotl(k2, 33)
          k2 = x64Multiply(k2, c1)
          h2 = x64Xor(h2, k2)
        // fallthrough
        case 8:
          k1 = x64Xor(k1, x64LeftShift([0, key.charCodeAt(i + 7)], 56))
        // fallthrough
        case 7:
          k1 = x64Xor(k1, x64LeftShift([0, key.charCodeAt(i + 6)], 48))
        // fallthrough
        case 6:
          k1 = x64Xor(k1, x64LeftShift([0, key.charCodeAt(i + 5)], 40))
        // fallthrough
        case 5:
          k1 = x64Xor(k1, x64LeftShift([0, key.charCodeAt(i + 4)], 32))
        // fallthrough
        case 4:
          k1 = x64Xor(k1, x64LeftShift([0, key.charCodeAt(i + 3)], 24))
        // fallthrough
        case 3:
          k1 = x64Xor(k1, x64LeftShift([0, key.charCodeAt(i + 2)], 16))
        // fallthrough
        case 2:
          k1 = x64Xor(k1, x64LeftShift([0, key.charCodeAt(i + 1)], 8))
        // fallthrough
        case 1:
          k1 = x64Xor(k1, [0, key.charCodeAt(i)])
          k1 = x64Multiply(k1, c1)
          k1 = x64Rotl(k1, 31)
          k1 = x64Multiply(k1, c2)
          h1 = x64Xor(h1, k1)
        // fallthrough
      }
      h1 = x64Xor(h1, [0, key.length])
      h2 = x64Xor(h2, [0, key.length])
      h1 = x64Add(h1, h2)
      h2 = x64Add(h2, h1)
      h1 = x64Fmix(h1)
      h2 = x64Fmix(h2)
      h1 = x64Add(h1, h2)
      h2 = x64Add(h2, h1)
      return ('00000000' + (h1[0] >>> 0).toString(16)).slice(-8) + ('00000000' + (h1[1] >>> 0).toString(16)).slice(-8) + ('00000000' + (h2[0] >>> 0).toString(16)).slice(-8) + ('00000000' + (h2[1] >>> 0).toString(16)).slice(-8)
    }