title: SHA-512 - salt my password
body: <p>As a exercise I wrote my own implementation of SHA-512 hash function in C++. I know it works because from <code>abc</code> i get</p>
  
  <pre><code>3a81oZNherrMQXNJriBBMRLm.k6JqX6iCp7u5ktV05ohkpkqJ0/BqDa6PCOj/uu9RU1EI2Q86A4qmslPpUyknw==
  </code></pre>
  
  <p>In Base64. Just like in test sites.</p>
  
  <p>I have two questions:</p>
  
  <ol>
  <li><p>How to salt my password? If I have:</p>
  
  <pre><code>string salt = "ssssssss";
  string pass = "mysecretpassword";
  </code></pre>
  
  <p>Should I create string to input as salt+pass="ssssssssmysecretpassword"? Or maybe in reverse manner? I tried to find the answer everywhere on google - I can't find something that would really fit.</p></li>
  <li><p>What encoding in base64 i should use to get exact hashed password like in /etc/shadow file?</p></li>
  </ol>