frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

MTOTP: Wouldn't it be nice if you were the 2FA device?

https://github.com/VBranimir/mTOTP/tree/develop
39•brna-2•1h ago

Comments

brna-2•1h ago
This is an early experiment in human-computable TOTP. Not production crypto, but a serious attempt to reach reasonable security for plausible 2FA. Protocol revisions, criticism, and contributions are welcome.
ramon156•6m ago
I don't really get what tone you're doing for. Is this "a serious attempt", or is this "something that does not guarantee any cryptographic security"?

Nonetheless I do not see what issues 2FA has that this solves. Having the electronic device is the security. Without it there is no security.

vbarrielle•1h ago
The idea is interesting, but I don't think this qualifies as a second factor, as it can be reduced to a factor you have to remember, so equivalent to a password. The second factor should be derived either from something you own, or something that can be obtained from biometry.
ulrikrasmussen•1h ago
In that case nothing based on RFC 6838 would qualify as a second factor because nothing prevents you from just remembering the TOTP secret and compute the one-time code using a piece of JS. Or even putting it in your password manager.

I think it is too simple to reduce the definition of second factor to how it is stored. It is rather a question of what you need to log in. For TOTP the client has the freedom to choose any of (not exhaustive):

1. Remember password, put TOTP in an app on smartphone => Client has to remember password and be in possession of smartphone.

2. Put password and TOTP in password manager => Client has to remember the master password to the password manager and be in possession of the device on which it runs. Technically, you have to be in possession of just the encrypted bits making up the password database, but it is still a second factor separate from the master password.

charcircuit•57m ago
For proper 2nd factors the secret is a hardware key that practically can not be extracted so it is impossible for someone to know it. They must obtain the piece of hardware to use the key.
fc417fc802•18m ago
Can't say I agree with this take. Sure, something hardware bound is more secure under certain threat models. For others it's largely irrelevant. There are also drawbacks, such as not being able to back it up. That might or might not matter. "Just" get a second hardware token, register that as well, and store it somewhere safe won't always be a realistic (or perhaps desirable) option for everyone in every scenario. It certainly reduces your flexibility.
ulrikrasmussen•4m ago
Yes, that is certainly a more secure second factor since there are fewer ways for an attacker to steal it, but I don't think that should be a necessary condition for it to be called a second factor at all.
Perz1val•51m ago
I put them in my password manager
fc417fc802•17m ago
> I think it is too simple to reduce the definition of second factor to how it is stored.

I think the defining characteristic is how it is used. I can use a password like a second factor, and I can use a TOTP code like a password. The service calls it a password or a second factor because that was the intention of the designer. But I can thwart those intentions if I so choose.

Recall the macabre observation that for some third factor implementations the "something you are" can quickly be turned into "something your attacker has".

barbegal•1h ago
An interesting idea but in theory just three correct pass codes and some brute force will reveal the secret key so you'd have to be very careful about only inputting the pass code to sites that you trust well.

It's definitely computable on a piece of paper and reasonably secure against replay attacks.

brna-2•1h ago
Yep, I am aware, 2 or 3 OTP's and timestamps plus some brute forcing using the source-code. Server-side brute force by input should or could be implausible. But that is why I am signaling here that I would love a genius or a playful expert/enthusiast contributing a bit or two to it - or becoming a co-author.
MattPalmer1086•1h ago
I was wondering about the overall security. How did you determine that 3 pass codes and brute force will reveal the secret key?
MattPalmer1086•40m ago
Thinking about it, there are only 10 billion different keys and somewhat fewer sboxes.

So given a single pass code and the login time, you can just compute all possible pass codes. Since more than one key could produce the same pass code, you would need 2 or 3 to narrow it down.

In fact, you don't even need to know the login time really, even just knowing roughly when would only increase the space to search by a bit.

crote•1h ago
What makes this 2FA? It's "something you know, plus mental labor", which makes it a password.

2FA is "something you have" (or ".. you are", for biometrics): it is supposed to prove that you currently physically posses the single copy of a token. The textbook example is a TOTP stored in a Yubikey.

Granted, this has been watered down a lot by the way-too-common practice of storing TOTP secrets in password managers, but that's how it is supposed to work.

Does your mTOTP prove you own the single copy? No, you could trivially tell someone else the secret key. Does it prove that you currently own it? No, you can pre-calculate a verification token for future use.

I still think it is a very neat idea on paper, but I'm not quite seeing the added value. The obvious next step is to do all the math in client-side code and just have the user enter the secret - doing this kind of mental math every time you log in is something only the most hardcore nerds get excited about.

brna-2•1h ago
Time based skew makes it a changeable second factor, additional changeable pass makes it the second factor, Also - if the first factor is a password manager or ssh key - this is the second factor.

The idea of it was so neat to me, I just had to thinker with it.

ulrikrasmussen•1h ago
In practice most TOTP implementation also do not prove that you have a device which is the sole owner of the secret. Except for proprietary app-based solutions the usual protocol is to display a QR code which just encodes the secret in plain text.

As long as you never enter the secret anywhere but only do the computation is your head, this is just using your brain as the second factor. I would not call this a password since it is not used in the same way. Passwords are entered in plain text into fields that you trust, but that also means that passwords can be stolen. This proves that you are in possession of your brain.

swiftcoder•10m ago
> Passwords are entered in plain text into fields that you trust, but that also means that passwords can be stolen

The only difference here is that you are hashing the password in your head, instead of trusting the client to hash it for you before submitting it to the server.

Which makes the threat model here what, exactly? Keyloggers, or login pages that use outdated/insecure methods to authenticate with the server?

ulrikrasmussen•6m ago
Yes, but also plain guessing since passwords are usually chosen by the user and not generated by the server like TOTP secrets. Also phishing attacks tricking users into entering their passwords in fake login pages, and stolen password databases.
rcxdude•1h ago
The single copy part would be a lot more common if it was widely supported to have multiple tokens registered to an account.

And the main point (though I agree that it doesn't make it 2FA), is to not have the secret be disclosed when you prove that you have it, which is what TOTP also achieves, which makes phishing or sniffing it significantly less valuable.

crote•7m ago
Are there any mainstream websites which only allow a single TOTP token to be enrolled? I can't remember having ever run into that issue. I do recall it occasionally being an issue with Passkeys, though.

The non-disclosure is indeed neat, but the same can be achieved with a password. For example: generate public/private keypair on account creation. Encrypt private key with user password. Store both on server. On auth, client downloads encrypted priv key, decrypts it with user-entered password, then signs nonce and provides it to server as proof of knowledge of user password.

fxj•33m ago
TOTP is also just password + some computation. So where is the difference? There is a lot of security theatre around TOTP with the QR code and then need of an app but you can write a 8 liner in python that does the same when you extract the password out of the QR code.

   import base64
   import hmac
   import struct
   import time

   def totp(key, time_step=30, digits=6, digest='sha1'):
        key = base64.b32decode(key.upper() + '=' \* ((8 - len(key)) % 8))
        counter = struct.pack('>Q', int(time.time() / time_step))
        mac = hmac.new(key, counter, digest).digest()
        offset = mac[-1] & 0x0f
        binary = struct.unpack('>L', mac[offset:offset+4])[0] & 0x7fffffff
        return str(binary)[-digits:].zfill(digits)

https://dev.to/yusadolat/understanding-totp-what-really-happ...
crote•15m ago
You are supposed to store the password in a Secure Enclave, which you can only query for the current token value. You are also supposed to immediately destroy the QR code after importing it.

As I already mentioned, the fact that people often use it wrong undermines its security, but that doesn't change the intended outcome.

josephg•27m ago
> 2FA is "something you have" (or ".. you are", for biometrics): it is supposed to prove that you currently physically posses the single copy of a token. The textbook example is a TOTP stored in a Yubikey.

No, 2FA means authentication using 2 factors of the following 3 factors:

- What you know (eg password)

- What you have (eg physical token)

- What you are (eg biometrics)

You can "be the 2FA" without a token by combining a password (what you know) and biometrics (what you are). Eg, fingerprint reader + password, where you need both to login.

crote•9m ago
Of course, but in most applications the use of a password is a given, so in day-to-day use "2FA" had come to mean "the other auth method, besides your password".

Combine that with the practical problems with biometrics when trying to auth to a remote system, and in practice that second factor is more often than not "something you have". And biometrics is usually more of a three-factor system, with the device you enrolled your fingerprints on being an essential part of the equation.

swiftcoder•1h ago
Isn't this just manually hashing a password with a timed-salt? I don't see how this relates to TOTP
ulrikrasmussen•1h ago
TOTP is also just hashing a password with a time salt. The purpose is just to prove that you are in possession of the device that stores the password without actually ever entering the password anywhere where it can be leaked. In this case the device is just your brain.
swiftcoder•16m ago
> In this case the device is just your brain

And that makes it a password (i.e. the primary factor, not a second factor). The whole point of a second factor is that it's not trivially cloneable (hence why, for example, SMS is a poor form of 2FA in the presence of widespread SIM cloning attacks).

ulrikrasmussen•9m ago
No, the defining characteristic of a password is also how it is used: it is communicated in the clear to the verifier, thus revealing it to eavesdroppers. It is highly non-trivial to clone the knowledge in someone's brain if they never openly communicate the mTOTP secret but only do the computations in their head.
cuckovic•1h ago
Really nice idea
MattPalmer1086•1h ago
What is the purpose of the 6th digit?

It doesnt add any security, as it is trivially computable from the other digits already computed.

It appears to be a checksum, but I can't see why one would be needed.

brna-2•39m ago
I originally included it as a structural integrity digit, with the option for early rejection on the server side. That early exit check is not implemented in the current PAM module yet.

This is an early POC, and sanity checks like this are exactly the kind of feedback I’m looking for.

gildenFish•33m ago
It probably isn't for security, it is more likely a quick check that the code that you memorized makes sense.
onion2k•55m ago
I don't think people plan what time to log into things.
brna-2•36m ago
Yep, they did not need to when the calculation was done in real time on a mobile phone. :D
deafpolygon•40m ago
I see 2FA is often misunderstood by people. The basic premise with 2FA is that you combine “something you know” with “something you have”.

You are already part of the 2FA — you’re the first factor: “something you know”.

The second factor: “something you have” — often a personal device, or an object. This is ideally something no one else can be in possession of at the same time as you are.

sigio•12m ago
Except that for 99% of my passwords, I am 100% sure I do not, and never will, know them, they are 60-100+ bytes of random data, only known by my passwordmanager. The only thing I know, is the passphrase for my passwordmanager. TOTP codes are also stored in there, but I see it more as a replay-protection for captured passwords, though this is also really a non-issue in this time of almost no plaintext protocols.
eisbaw•26m ago
or we could use asymmetric biometric fingerprints. Turns out features can be extracted into public and private sets, and both are required for a match. I hold a patent on it btw

Led by Texas, New Hampshire, U.S. states put Bitcoin on public balance sheet

https://www.cnbc.com/2026/01/17/texas-us-states-budgets-bitcoin-crypto-strategic-reserve.html
1•TMWNN•56s ago•1 comments

Show HN: Gdocs-CLI – Fetch Google Docs as Markdown for AI Coding Agents

https://github.com/famasya/gdocs-cli
1•pacific01•1m ago•0 comments

CVEFinder – Fast CVE lookup with product-level mapping

1•cvefinder•4m ago•0 comments

Ask HN: "Unfortunately, humanity's future is in the hands of [redacted]"

1•fdeage•4m ago•0 comments

The Jolla Phone Proved We've Been Using Smartphones Wrong All Along

https://techglimmer.io/jolla-phone-2026-review-kill-switch-privacy-review/#Jolla
3•mpol•4m ago•0 comments

NASA ID Sy1174304 – O(1) Strategic Proposal: Alzheimer's and Longevity

1•MASTER_shivam•4m ago•0 comments

Last year I eliminated our PTO policy. I called it "unlimited."

https://twitter.com/gothburz/status/2011421898161144192
2•marbartolome•6m ago•0 comments

Castle Engine downloads with bundled FPC for all platforms

https://castle-engine.io/wp/2026/01/18/engine-downloads-with-bundled-fpc-for-all-platforms-castle...
1•mariuz•7m ago•0 comments

2026 Adamuz Train Derailments

https://en.wikipedia.org/wiki/2026_Adamuz_train_derailments
1•Rygian•9m ago•0 comments

Determinate: End-to-End Nix for macOS, WSL, Linux

https://docs.determinate.systems/
1•Lwrless•10m ago•0 comments

Show HN: ChatGPT Projects wasn't enough, so I built my "dream notes app"

https://apps.apple.com/us/app/wiz-note-ai-smart-notes/id6757632086
1•wabiosdev•12m ago•0 comments

TPM on Embedded Systems: Pitfalls and Caveats to Watch Out For

https://sigma-star.at/blog/2026/01/tpm-on-embedded-systems-pitfalls-and-caveats/
3•Deeg9rie9usi•14m ago•0 comments

Snowflakes in Print

https://blogs.loc.gov/inside_adams/2022/01/snowflakes-in-print/
1•jruohonen•14m ago•0 comments

I recently hit 1K GitHub stars on github.com/learning-cloud-native-go/myapp:)

1•dumindunuwan•15m ago•0 comments

Science journals retract 500 papers a month

https://www.thetimes.com/uk/science/article/science-journals-retract-500-papers-a-month-this-is-w...
2•robtherobber•16m ago•0 comments

Models of generics and metaprogramming: Golang, Rust, Swift, D, and more

https://thume.ca/2019/07/14/a-tour-of-metaprogramming-models-for-generics/
1•fanf2•17m ago•0 comments

Alzheimer's finger-prick test could help diagnosis

https://www.bbc.com/news/articles/cq5y85e8d2xo
1•1659447091•18m ago•0 comments

Show HN: I built a free text-to-speech plugin for WordPress

https://wordpress.org/plugins/speechable/
1•Tanishmittal•20m ago•0 comments

SIMD Programming in Pure Rust

https://kerkour.com/introduction-rust-simd
2•randomint64•20m ago•0 comments

US believes its power matters more than international law, UN chief

https://www.bbc.co.uk/news/articles/c4g0zx0llpzo
2•treadump•23m ago•0 comments

Show HN: I built a Next.js boilerplate to stop fighting with CSS

https://veloxweb.gumroad.com/l/launch-ui
1•asliper•24m ago•0 comments

Bring Back Ops Pride

https://charity.wtf/2026/01/19/bring-back-ops-pride-xpost/
1•BerislavLopac•25m ago•0 comments

Greenpeace pilot brings heat pumps and solar to Ukrainian community

https://www.pveurope.eu/power2heat/greenpeace-pilot-brings-heat-pumps-and-solar-ukrainian-community
3•doener•26m ago•0 comments

Show HN: Bundle a large codebase for use across multiple LLM apps

1•koistya•26m ago•0 comments

Show HN: Visual Database Schema Designer (Angular 21 and .NET 10)

https://dbvisualdesigner.com
1•temakonkin•27m ago•1 comments

Claude Skill for Terraform/OpenTofu – testing, modules, CI/CD, and prod patterns

https://github.com/antonbabenko/terraform-skill
1•antonbabenko•28m ago•1 comments

Awesome-ralph: A curated list of resources about Ralph, the AI coding technique

https://github.com/snwfdhmp/awesome-ralph
1•snwfdhmp•33m ago•0 comments

Coding Adventure: Ray Tracer

https://www.youtube.com/playlist?list=PLFt_AvWsXl0dlgwe4JQ0oZuleqOTjmox3
1•ivanjermakov•35m ago•0 comments

The surprising benefits of standing on one leg

https://www.bbc.com/future/article/20260114-the-surprising-benefits-of-standing-on-one-leg
1•1659447091•36m ago•0 comments

Show HN: Aeph – Just a paper for your terminal, not an editor

https://github.com/siki-712/aeph
2•ovonvo•37m ago•0 comments