# Module: crypto/cfb

## crypto/cfb

Source:
  - crypto/cfb.js, line 18

### Methods

#### <static> decrypt(blockcipherfn, block_size, plaintext, key, resync) → {String}

  This function decrypts a given plaintext using the specified blockcipher to decrypt a message

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `blockcipherfn` | openpgp_block_cipher_fn | The algorithm _encrypt_ function to encrypt data in one block_size encryption.
  `block_size` | Integer | the block size in bytes of the algorithm used
  `plaintext` | String | ciphertext to be decrypted provided as a string
  `key` | openpgp_byte_array | key to be used to decrypt the ciphertext. This will be passed to the blockcipherfn
  `resync` | Boolean | a boolean value specifying if a resync of the IV should be used or not. The encrypteddatapacket uses the "old" style with a resync. Decryption within an encryptedintegrityprotecteddata packet is not resyncing the IV.

  Source:
    - crypto/cfb.js, line 200

  ##### Returns:

  a string with the plaintext data
  Type
    String

#### <static> encrypt(prefixrandom, blockcipherfn, block_size, plaintext, key, resync) → {String}

  This function encrypts a given with the specified prefixrandom using the specified blockcipher to encrypt a message

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `prefixrandom` | String | random bytes of block_size length provided as a string to be used in prefixing the data
  `blockcipherfn` | openpgp_block_cipher_fn | the algorithm encrypt function to encrypt data in one block_size encryption.
  `block_size` | Integer | the block size in bytes of the algorithm used
  `plaintext` | String | data to be encrypted provided as a string
  `key` | openpgp_byte_array | key to be used to encrypt the data. This will be passed to the blockcipherfn
  `resync` | Boolean | a boolean value specifying if a resync of the IV should be used or not. The encrypteddatapacket uses the "old" style with a resync. Encryption within an encryptedintegrityprotecteddata packet is not resyncing the IV.

  Source:
    - crypto/cfb.js, line 57

  ##### Returns:

  a string with the encrypted data
  Type
    String

#### <static> mdc(block_size, key, ciphertext) → {String}

  Decrypts the prefixed data for the Modification Detection Code (MDC) computation

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `cipherfn.encrypt` | openpgp_block_cipher_fn | Cipher function to use
  `block_size` | Integer | Blocksize of the algorithm
  `key` | openpgp_byte_array | The key for encryption
  `ciphertext` | String | The encrypted data

  Source:
    - crypto/cfb.js, line 160

  ##### Returns:

  plaintext Data of D(ciphertext) with blocksize length +2
  Type
    String