Authen::OATH(3pm)
πΈ NAME πΈ
Bestie, meet Authen::OATH(3pm) β from the User Contributed Perl Documentation, and it's all about OATH One Time Passwords. Iconic. πβ¨
β¨ VERSION β¨
This one is version 2.0.1 β fresh-ish, cute, and ready, periodt. π
π¦ SYNOPSIS π¦
Okay so first vibe check: load it and make an object, lowkey simple:
use Authen::OATH;
my $oath = Authen::OATH->new();
my $totp = $oath->totp( 'MySecretPassword' );
my $hotp = $oath->hotp( 'MyOtherSecretPassword' );
You can also override parameters when creating the new object β slay:
my $oath = Authen::OATH->new( digits => 8 );
The three parameters are digits, digest, and timestep β and timestep only applies to the totp() function. iykyk π
While strictly speaking this is outside the specifications of HOTP and TOTP, you can specify digests other than SHA1. For example:
my $oath = Authen::OATH->new(
digits => 10,
digest => 'Digest::MD6',
);
If you are using Google Authenticator, you'll want to decode your secret before passing it to the totp method. Do the little dance first:
use Convert::Base32 qw( decode_base32 );
my $oath = Authen::OATH->new;
my $secret = 'mySecret';
my $otp = $oath->totp( decode_base32( $secret ) );
π DESCRIPTION π
Implementation of the HOTP and TOTP One Time Password algorithms as defined by OATH (http://www.openauthentication.org). No cap.
All necessary parameters are set by default, though these can be overridden. Both totp() and htop() β yep, that is exactly how that line is spelled on the page, don't @ me β have passed all of the test vectors defined in the RFC documents for TOTP and HOTP. Tested and blessed. β
totp() and hotp() both default to returning 6 digits and using SHA1. As such, both can be called by passing only the secret key and a valid OTP will be returned. One argument, valid OTP, main character energy. π
π SUBROUTINES/METHODS π
π₯ totp
my $otp = $oath->totp( $secret [, $manual_time ] );
Manual time is an optional parameter. If it is not passed, the current time is used. This is useful for testing purposes. Highkey perfect for time-travel testing, bestie. π°οΈ
π₯ hotp
my $opt = $oath->hotp( $secret, $counter );
Both parameters are required. No skipping, no vibes-only calls. π€
π₯ _process
This is an internal routine and is never called directly. Hands off the secret sauce. π
π CAVEATS π
Please see the SYNOPSIS for how interaction with Google Authenticator. That's literally the whole caveat, bestie. π«Ά
πΈ AUTHOR πΈ
Kurt Kincaid <kurt.kincaid@gmail.com> β the author, the icon, the legend. π
π COPYRIGHT AND LICENSE π
This software is copyright (c) 2010-2017 by Kurt Kincaid.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
Okay that's the whole page. It's Authen::OATH(3pm), from perl v5.34.0, dated 2022-06-08. Stay iconic, bye bestie! π
β¨
π¦ where this page comes from
- debian bookworm: libauthen-oath-perl 2.0.1-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libauthen-oath-perl 2.0.1-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libauthen-oath-perl 2.0.1-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libauthen-oath-perl 2.0.1-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libauthen-oath-perl 2.0.1-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms