summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCalvin Morrison <calvin@fastmailteam.com>2018-10-16 09:58:33 -0400
committerCalvin Morrison <calvin@fastmailteam.com>2018-10-16 09:58:33 -0400
commit2aa85f379bd8e18112bc27587022a0a2b79cbafb (patch)
tree1ee9850681944f999800127a20711b9621af5e6d
parent8e624684ab3c3db83febcb2d76be208a96f234da (diff)
clarify comments
-rw-r--r--totp.pl8
1 files changed, 4 insertions, 4 deletions
diff --git a/totp.pl b/totp.pl
index 21a0c00..bfbda7d 100644
--- a/totp.pl
+++ b/totp.pl
@@ -9,8 +9,7 @@ sub hmac_sha1_hex_string {
return Digest::SHA::hmac_sha1_hex($data, $key);
}
-# everything is 2 here because we are looking at the byte level.. probably
-# should just convert this into a byte array but I'm a noob
+# make a usable number out of that HMAC result
sub hotp_truncate {
my ($hex) = @_;
my $lastbyte= substr $hex, -2;
@@ -30,8 +29,7 @@ sub hotp_truncate {
return $truncate;
}
-# TOTP is HOTP(K,c) where counter c is time based and changed every 30 seconds (here)
-# HOTP
+# TOTP is HOTP(K,c) where counter c is time based and changed every x seconds (30 here)
sub totp {
my ($time, $secret) = @_;
@@ -43,6 +41,8 @@ sub totp {
return $otp;
}
+
+# basically HMAC(key, counter)
sub hotp {
my ($time, $secret) = @_;