title: How to calculate sha1 base64 encoded in windows batch?
body: <p>I am trying to get a base64 encoded sha1 hash in a windows batch file.
  The first thing I tried was with perl:</p>
  
  <pre><code>perl -M"Digest::SHA1 qw(sha1_base64)" -e "open(F,shift) or die; binmode F; print sha1_base64(&lt;F&gt;), qq(=\n)" "test.mxf"
  </code></pre>
  
  <p>This works great, but only for small files. With big files it says "Out of memory".</p>
  
  <p>Then I downloaded an openssl version for windows and tried this:</p>
  
  <pre><code>"C:\openssl.exe" dgst -sha1 -binary -out "hash_sha1.txt" "C:\test.mxf"
  set /p hash_sha1=&lt;"hash_sha1.txt"
  del "hash_sha1.txt"
  echo !hash_sha1!
  
  echo -n '!hash_sha1!' | "C:\openssl.exe" enc -base64
  </code></pre>
  
  <p>But the output of the openssl method is different from the Perl output and I know that the Perl method produces the correct output. What do I have to change?</p>