code: def encrypt(plainstring, R):
      r"""
      Encrypts a string using the Type 1 encryption algorithm.
  
      Note that the algorithm as described in the Type 1 specification requires the
      plaintext to be prefixed with a number of random bytes. (For ``eexec`` the
      number of random bytes is set to 4.) This routine does *not* add the random
      prefix to its input.
  
      Args:
              plainstring: String of plaintext.
              R: Initial key.
  
      Returns:
              cipherstring: Ciphertext string.
              R: Output key for subsequent encryptions.
  
      Examples::
  
              >>> testStr = b"\0\0asdadads asds\265"
              >>> decryptedStr, R = decrypt(testStr, 12321)
              >>> decryptedStr == b'0d\nh\x15\xe8\xc4\xb2\x15\x1d\x108\x1a<6\xa1'
              True
              >>> R == 36142
              True
  
      >>> testStr = b'0d\nh\x15\xe8\xc4\xb2\x15\x1d\x108\x1a<6\xa1'
      >>> encryptedStr, R = encrypt(testStr, 12321)
      >>> encryptedStr == b"\0\0asdadads asds\265"
      True
      >>> R == 36142
      True
      """
      cipherList = []
      for plain in plainstring:
          cipher, R = _encryptChar(plain, R)
          cipherList.append(cipher)
      cipherstring = bytesjoin(cipherList)
      return cipherstring, int(R)
  
imports: from fontTools.misc.textTools import bytechr, bytesjoin, byteord
label_desc: Use image node_id 4 for calling a global function with example usage: encrypt(plainstring, R) and returns: cipherstring,  int