ciphertext is the output here
329067
function encryptAndHash (state, ciphertext, plaintext) {
  assert(state.byteLength === STATELEN)
  assert(ciphertext.byteLength != null)
  assert(plaintext.byteLength != null)

  var cstate = state.subarray(CIPHER_BEGIN, CIPHER_END)
  var h = state.subarray(HASH_BEGIN, HASH_END)

  cipherState.encryptWithAd(cstate, ciphertext, h, plaintext)
  encryptAndHash.bytesRead = cipherState.encryptWithAd.bytesRead
  encryptAndHash.bytesWritten = cipherState.encryptWithAd.bytesWritten
  mixHash(state, ciphertext.subarray(0, encryptAndHash.bytesWritten))
}
1016323
function encryptAES256CBCWithPassword(plainText, password) {
	var iv = crypto.randomBytes(16);
	var passwordHash = hash.getSha256Hash(password, 'utf8');
	var cipher = crypto.createCipheriv('aes-256-cbc', passwordHash, iv);
	var firstBlock = cipher.update(plainText, 'utf8');
	var encrypted = Buffer.concat([firstBlock, cipher.final()]);
	
	return {
		cipher: encrypted.toString('hex'),
		iv: iv.toString('hex'),
	};
}
1274621
public static String decode(String ciphertext, int offset) {
		final int len = ciphertext.length();
		final char[] plain = ciphertext.toCharArray();
		char c;
		for (int i = 0; i < len; i++) {
			c = ciphertext.charAt(i);
			if (false == Character.isLetter(c)) {
				continue;
			}
			plain[i] = decodeChar(c, offset);
		}
		return new String(plain);
	}
1362744
function aesEncrypt(msg, key, iv) {
    var logger = getLogger('security.cipher.aesEncrypt');
    // Check if padding is needed
    var padding = msg.length % 16;
    if (padding > 0) {
        var paddingBuffer = utility.createRandomBuffer(16 - padding);
        msg = Buffer.concat([msg, paddingBuffer]);
    }
    // Convert buffers to wordArrays
    var plainMsg = buffer2WordArray(msg);
    var keyWordArray = buffer2WordArray(key);
    var ivWordArray = buffer2WordArray(iv);
    if (logger.isDebugEnabled()) {
        logger.debug('plainMsg = %s\nkeyWordArray = %s\nivWordArray = %s',
            JSON.stringify(plainMsg), JSON.stringify(keyWordArray), JSON.stringify(ivWordArray));
    }
    // Encrypt plain message
    var encryptedWordArray = CryptoJS.AES.encrypt(plainMsg, keyWordArray, {
        iv: ivWordArray,
        padding: CryptoJS.pad.NoPadding,
        mode: CryptoJS.mode.IGE
    }).ciphertext;
    if (logger.isDebugEnabled()) {
        logger.debug('encryptedWordArray = %s', JSON.stringify(encryptedWordArray));
    }
    // Return the encrypted buffer
    return wordArray2Buffer(encryptedWordArray);
}
1140231
function encrypt(userKey, plainText) {
        var i
          , offset
          , ct = []
          , tmpBlockEncrypt;

        if (utils.isAnArray(userKey) &&
          utils.isAnArray(plainText)) {

          userKey = new Uint8Array(userKey);
          plainText = new Uint8Array(plainText);
        } else {

          throw 'Inputs must be an array';
        }

        userKey = makeKey(userKey);

        for (offset = 0; offset < plainText.length; offset += 16) {

          tmpBlockEncrypt = blockEncrypt(plainText, offset, userKey);
          for (i = 0; i < tmpBlockEncrypt.length; i += 1) {

            ct.push(tmpBlockEncrypt[i]);
          }
        }

        return ct;
      }
1169822
def encrypt(self, plaintext):
        """"""

        # Encrpyt message key.
        msg_key = random_letters(3)
        while msg_key == self.grundstellung:
            msg_key = random_letters(3)
        self.machine.set_display(self.grundstellung)
        enc_key = self.machine.process_text(msg_key)

        # Encrpyt message.
        self.machine.set_display(msg_key)
        ciphertext = self.machine.process_text(plaintext)

        # Encode message with keys.
        return "{enc_key}{ciphertext}{grundstellung}".format(
            enc_key=enc_key,
            ciphertext=ciphertext,
            grundstellung=self.grundstellung
        )
874533
public static String decipher(String key,
                                  String cipherText,
                                  String cipherType) {
        if (key == null || key == "") {
            return cipherText;
        }

        if (cipherText == null) {
            return null;
        }

        if (cipherType == null || cipherType == "") {
            return cipherText;
        } else if ("1".equalsIgnoreCase(cipherType)) {
            byte[] keyBytes = convertKeyToByteArray(key);
            byte[] cipherBytes = Base64.decode(cipherText);
            sanityCheckOnCipherBytes(cipherText, cipherBytes);
            byte[] clearTextBytes = applyCipher(keyBytes, cipherBytes);
            return convertByteArrayToClearText(clearTextBytes);
        } else {
            throw new IllegalArgumentException("Unrecognized cipher type: '"
                    + cipherType + "'");
        }
    }
1035191
def decrypt(self, ciphertext):
        """"""

        # Separate keys from message.
        enc_key = ciphertext[:3]
        message = ciphertext[3:-3]
        grundstellung = ciphertext[-3:]

        # Decrypt message key.
        self.machine.set_display(grundstellung)
        msg_key = self.machine.process_text(enc_key)
        # Decrpyt message.
        self.machine.set_display(msg_key)
        return self.machine.process_text(message)
551205
function token() {
  var len = arguments[0] === undefined ? 20 : arguments[0];
  var encoding = arguments[1] === undefined ? 'hex' : arguments[1];

  return (0, _mzCrypto.randomBytes)(len).then(function (buf) {
    return buf.toString(encoding);
  });
}
231904
@Override
    public int decode ( byte[] buffer, int bufferIndex, int len ) throws SMBProtocolDecodingException {
        int start = bufferIndex;
        int nciphers = SMBUtil.readInt2(buffer, bufferIndex);
        bufferIndex += 2;

        this.ciphers = new int[nciphers];
        for ( int i = 0; i < nciphers; i++ ) {
            this.ciphers[ i ] = SMBUtil.readInt2(buffer, bufferIndex);
            bufferIndex += 2;
        }

        return bufferIndex - start;
    }
1153610
function RSAEncrypt(text) {
  var m = pkcs1pad2(text, (this.n.bitLength() + 7) >> 3);
  if (m === null) return null;
  var c = this.doPublic(m);
  if (c === null) return null;
  var h = c.toString(16);
  //if((h.length & 1) === 0) return h; else return "0" + h;
  return FixEncryptLength(h);
}
1142072
public synchronized String encrypt(String plainText) {
        assertArgumentNotNull("plainText", plainText);
        if (encryptingCipher == null) {
            initialize();
        }
        return new String(encodeHex(doEncrypt(plainText)));
    }
292866
private byte[] decodeBytes(String cipherString) {
        String[] cipherStringBytes = cipherString.split(":");
        byte[] cipherBytes = new byte[cipherStringBytes.length];
        for (int i = 0; i < cipherStringBytes.length; i++) {
            cipherBytes[i] = Byte.parseByte(cipherStringBytes[i]);
        }
        return cipherBytes;
    }
15626
def cipher(rkey, pt, Nk=4):
    """"""
    assert Nk in {4, 6, 8}
    Nr = Nk + 6

    rkey = rkey.reshape(4*(Nr+1), 32)
    pt = pt.reshape(128)

    # first round
    state = add_round_key(pt, rkey[0:4])

    for i in range(1, Nr):
        state = sub_bytes(state)
        state = shift_rows(state)
        state = mix_columns(state)
        state = add_round_key(state, rkey[4*i:4*(i+1)])

    # final round
    state = sub_bytes(state)
    state = shift_rows(state)
    state = add_round_key(state, rkey[4*Nr:4*(Nr+1)])

    return state
514934
private int bufferCrypt(ByteBuffer input, ByteBuffer output,
            boolean isUpdate) throws ShortBufferException,
            IllegalBlockSizeException, BadPaddingException {
        if ((input == null) || (output == null)) {
            throw new NullPointerException
                ("Input and output buffers must not be null");
        }
        int inPos = input.position();
        int inLimit = input.limit();
        int inLen = inLimit - inPos;
        if (isUpdate && (inLen == 0)) {
            return 0;
        }
        int outLenNeeded = engineGetOutputSize(inLen);
        if (output.remaining() < outLenNeeded) {
            throw new ShortBufferException("Need at least " + outLenNeeded
                + " bytes of space in output buffer");
        }

        boolean a1 = input.hasArray();
        boolean a2 = output.hasArray();

        if (a1 && a2) {
            byte[] inArray = input.array();
            int inOfs = input.arrayOffset() + inPos;
            byte[] outArray = output.array();
            int outPos = output.position();
            int outOfs = output.arrayOffset() + outPos;
            int n;
            if (isUpdate) {
                n = engineUpdate(inArray, inOfs, inLen, outArray, outOfs);
            } else {
                n = engineDoFinal(inArray, inOfs, inLen, outArray, outOfs);
            }
            input.position(inLimit);
            output.position(outPos + n);
            return n;
        } else if (!a1 && a2) {
            int outPos = output.position();
            byte[] outArray = output.array();
            int outOfs = output.arrayOffset() + outPos;
            byte[] inArray = new byte[getTempArraySize(inLen)];
            int total = 0;
            do {
                int chunk = Math.min(inLen, inArray.length);
                if (chunk > 0) {
                    input.get(inArray, 0, chunk);
                }
                int n;
                if (isUpdate || (inLen != chunk)) {
                    n = engineUpdate(inArray, 0, chunk, outArray, outOfs);
                } else {
                    n = engineDoFinal(inArray, 0, chunk, outArray, outOfs);
                }
                total += n;
                outOfs += n;
                inLen -= chunk;
            } while (inLen > 0);
            output.position(outPos + total);
            return total;
        } else { // output is not backed by an accessible byte[]
            byte[] inArray;
            int inOfs;
            if (a1) {
                inArray = input.array();
                inOfs = input.arrayOffset() + inPos;
            } else {
                inArray = new byte[getTempArraySize(inLen)];
                inOfs = 0;
            }
            byte[] outArray = new byte[getTempArraySize(outLenNeeded)];
            int outSize = outArray.length;
            int total = 0;
            boolean resized = false;
            do {
                int chunk =
                    Math.min(inLen, (outSize == 0? inArray.length : outSize));
                if (!a1 && !resized && chunk > 0) {
                    input.get(inArray, 0, chunk);
                    inOfs = 0;
                }
                try {
                    int n;
                    if (isUpdate || (inLen != chunk)) {
                        n = engineUpdate(inArray, inOfs, chunk, outArray, 0);
                    } else {
                        n = engineDoFinal(inArray, inOfs, chunk, outArray, 0);
                    }
                    resized = false;
                    inOfs += chunk;
                    inLen -= chunk;
                    if (n > 0) {
                        output.put(outArray, 0, n);
                        total += n;
                    }
                } catch (ShortBufferException e) {
                    if (resized) {
                        // we just resized the output buffer, but it still
                        // did not work. Bug in the provider, abort
                        throw (ProviderException)new ProviderException
                            ("Could not determine buffer size").initCause(e);
                    }
                    // output buffer is too small, realloc and try again
                    resized = true;
                    outSize = engineGetOutputSize(chunk);
                    outArray = new byte[outSize];
                }
            } while (inLen > 0);
            if (a1) {
                input.position(inLimit);
            }
            return total;
        }
    }
248046
function decodeCryptojsSalt (input) {
  var ciphertext = Buffer.from(input, 'base64')
  if (ciphertext.slice(0, 8).toString() === 'Salted__') {
    return {
      salt: ciphertext.slice(8, 16),
      ciphertext: ciphertext.slice(16)
    }
  } else {
    return {
      ciphertext: ciphertext
    }
  }
}
309546
function encryptCBC(userKey, plainText) {
        if (utils.isAnArray(userKey) &&
          utils.isAnArray(plainText)) {

          userKey = new Uint8Array(userKey);
          plainText = new Uint8Array(plainText);
        } else {

          throw 'Inputs must be an array';
        }
        userKey = makeKey(userKey);

        var result = []
          , loops = plainText.length / BLOCK_SIZE
          , pos = 0
          , cBuffer = []
          , buffer1 = []
          , buffer2 = []
          , vector = initializingVector
          , index = 0
          , secondIndex = 0
          , tmpCBuffer
          , nVal
          , position;

        for (; index < loops; index += 1) {

          cBuffer = plainText.subarray(pos, pos + BLOCK_SIZE);
          if (cBuffer.length < BLOCK_SIZE) {

            tmpCBuffer = [];
            for (paddingIndex = 0; paddingIndex < BLOCK_SIZE; paddingIndex += 1) {

              nVal = cBuffer[paddingIndex];
              if (nVal !== undefined) {

                tmpCBuffer.push(nVal);
              } else {

                tmpCBuffer.push(0x00);
              }
            }
            cBuffer = tmpCBuffer;
          }
          buffer1 = xorBuffers(cBuffer, vector);
          buffer2 = blockEncrypt(buffer1, 0, userKey);

          for (secondIndex = pos; secondIndex < buffer2.length + pos; secondIndex += 1) {

            position = secondIndex - pos;
            if (buffer2[position] !== undefined) {

              result.splice(secondIndex, 0, buffer2[position]);
            }
          }
          vector = buffer2;
          pos += BLOCK_SIZE;
        }

        return result;
      }