function GoogleAuthenticatorCode(string secret) key := base32decode(secret) message := current Unix time ÷ 30 hash := HMAC-SHA1(key, message) offset := last nibble of hash truncatedHash := hash[offset..offset+3] //4 bytes starting at the offset Set the first bit of truncatedHash to zero //remove the most significant bit code := truncatedHash mod 1000000 pad code with 0 until length of code is 6 return code
podrobnosti na http://en.wikipedia.org/wiki/Google_Authenticator