title: Google Authenticator implementation in Perl
body: <p>I am looking for a simple Perl implementation that verifies a Google authenticator token that has been created using a server side secret. For instance,</p>
  
  <p>The following Google URL allows you to encode a server secret in base32 format (in the below case the secret is <b>e4ytonjeim4hcsrhja5fe5kqfu</b>) as a QR code that can be read from Google authenticator app (see image below):<BR>
  <a href="https://chart.googleapis.com/chart?cht=qr&amp;chs=100x100&amp;chl=otpauth%3A%2F%2Ftotp%2Fmysite%3A29%3Fsecret%3De4ytonjeim4hcsrhja5fe5kqfu%26issuer%3Dmysite" rel="nofollow noreferrer">https://chart.googleapis.com/chart?cht=qr&amp;chs=100x100&amp;chl=otpauth%3A%2F%2Ftotp%2Fmysite%3A29%3Fsecret%3De4ytonjeim4hcsrhja5fe5kqfu%26issuer%3Dmysite</a></p>
  
  <p><img src="https://chart.googleapis.com/chart?cht=qr&amp;chs=200x200&amp;chl=otpauth%3A%2F%2Ftotp%2Fmysite%3A29%3Fsecret%3De4ytonjeim4hcsrhja5fe5kqfu%26issuer%3Dmysite"></p>
  
  <p>Once the QR code is scanned into the authenticator app it produces tokens like: 716340. How do I verify the correctness of the token?</p>
  
  <p>This question is the Perl equivalent of this Python question:
  <a href="https://stackoverflow.com/questions/8529265/google-authenticator-implementation-in-python/">Google Authenticator implementation in Python</a></p>