title: C++ encrypt/decrypt with the same key
body: <p>I am new to the security stuff. Is there any way to encrypt and decrypt a security key with the same encryption key?</p>
  
  <p>The real use case is:</p>
  
  <ul>
  <li>Got a security key (32-char), need to hard-coded it into C++ code. But I don't want to have it plain text in C++.</li>
  <li>So I choose a password (like 8-char long), pass this to a hash function, like SHA2 and get a 128 bytes hash.</li>
  <li>Encrypt the 128 bytes hash with my security key, and save that output <strong>encrypted string</strong> to C++ code.</li>
  </ul>
  
  <p>When use using the application:</p>
  
  <ul>
  <li>Prompt for password (8-char).</li>
  <li>My application take the password and generate the hash through SHA2</li>
  <li>Decrypt the <strong>encrypted string</strong> with the SHA2 hash to get the original security key (32-char).</li>
  </ul>
  
  <p>Since the design has to put the security code in C++, we wanted to find out a way to secure it. With the above mechanism, we are putting the original code in C++ directly.</p>