Structure
HOTP
Create a one-time password using hash-based message authentication codes.
struct HOTP
Overview
let key = SymmetricKey(size: .bits128)
let code = HOTP.SHA1(key: key).generate(counter: 0)
print(code) "208503"
See TOTP for time-based one-time passwords.
Topics
Initializers
init(key: SymmetricKey, digest: OTPDigest, digits: OTPDigits)Initialize the HOTP object.
Instance Methods
func generate(counter: UInt64) -> StringGenerate the HOTP based on the counter.func generate(counter: UInt64, range: Int) -> [String]Generates several HOTP’s for a range.
Type Methods
static func generate(key: SymmetricKey, digest: OTPDigest, digits: OTPDigits, counter: UInt64) -> StringCompute the HOTP for the key and the counter.
Relationships
Conforms To
Swift.SendableSwift.SendableMetatype
See Also
One-Time Passwords
struct TOTPCreate a one-time password using hash-based message authentication codes and taking uniqueness from the time.enum OTPDigitsSupported OTP output sizes.enum OTPDigestSupported OTP digests.