Ah, I was imagining it as it's own thing that just happened to share some 
interfaces. I don't think there is any nonHOTP type that you could ever use 
in its place for TOTP?


On 13 February 2014 18:05:52 David Reid <notifications@github.com> wrote:

> > +
> > +        self._key = key
> > +        self._length = length
> > +        self._backend = backend
> > +
> > +    def generate(self, counter):
> > +        truncated_value = self._dynamic_truncate(counter)
> > +        hotp = truncated_value % (10**self._length)
> > +        return "{0:0{1}}".format(hotp, self._length).encode()
> > +
> > +    def verify(self, hotp, counter):
> > +        if not constant_time.bytes_eq(self.generate(counter), hotp):
> > +            raise InvalidToken("Supplied HOTP value does not match")
> > +
> > +    def _dynamic_truncate(self, counter):
> > +        ctx = hmac.HMAC(self._key, SHA1(), self._backend)
>
> I suppose it depends where you think the parameter should go.
>
> I had assumed that a TOTP implementation just composed over the public HOTP 
> class, which means the hash algorithm would need to be a constructor 
> argument to HOTP.
>
> ---
> Reply to this email directly or view it on GitHub:
> https://github.com/pyca/cryptography/pull/598/files#r9719652