title: Deterministic Encryption - Generating IV from password key
body: <p>I need to encrypt file and directory names/paths but I need the encryption to be deterministic. I need to sync the local files with a cloud storage provider so I can't use probabilistic encryption.</p>
  <p>Know that you should not use a static IV when encrypting text, would this be an acceptable work around:</p>
  <ul>
  <li>Run passphrase through scrypt and store resulting output</li>
  <li>Take the resulting output from scrypt and hash it (using MD5 for example)</li>
  <li>Take the first 16 bytes of the hash and use it as the IV to encrypt the directory and file name</li>
  </ul>
  <p>The only other thing I can think of:</p>
  <ul>
  <li>Use probabilistic encryption</li>
  <li>Read the directory/file structure from the cloud service provider and local directory</li>
  <li>Map all the encrypted cloud provider names with their decrypted values</li>
  <li>Map all the encrypted local names with their decrypted values</li>
  <li>Sync based on the mappings found above</li>
  </ul>
  <p>The only issue with that is that it is time consuming and really difficult to implement when using different cloud service providers.</p>