This article is a mirror article of machine translation, please click here to jump to the original article.

View: 117994|Reply: 14

[Source] .NET/C# generates one-time passwords based on TOTP

[Copy link]
Posted on 7/25/2020 6:50:04 PM | | | |
OTP is short for One-Time Password, which means one-time password.

Common products on the market:

  • Ning shield token
  • Alibaba's identity treasure
  • Google's authenticator (google-authenticator)
  • QQ token



Dynamic token OTP, TOTP, and HOTP difference
https://www.itsvse.com/thread-9326-1-1.html
Angular 9 series (XII) generates dynamic tokens based on OTPs
https://www.itsvse.com/thread-9325-1-1.html
WeChat mini program implements OTP dynamic password
https://www.itsvse.com/thread-9329-1-1.html

Let's create a new .NET 4.5 project.

nuget install the plugin with the following command:

We try to generate a password every 60 seconds, using the SHA1 algorithm, and the code is as follows:

I found a website for an online TOTP Token Generator, and the default algorithm is sha1.

The hyperlink login is visible.

Try to run the program, and the generated dynamic password is as shown in the figure below:


Remark:The SecretKey must be a base32 string,Otherwise, the error will be as follows:

Character is not a Base32 character

Source code download:

Tourists, if you want to see the hidden content of this post, pleaseReply


(End)


Score

Number of participants1MB+1 contribute+1 Collapse reason
conntfs + 1 + 1 Very powerful!

See all ratings





Previous:Dynamic token OTP, TOTP, and HOTP difference
Next:Now you can provide attr `wx:key` for a `wx:for` to improve.
Posted on 10/30/2024 10:53:34 PM |

I was thinking of a client-side authentication solution
Posted on 7/28/2020 9:29:28 PM |
NET/C# generates one-time passwords based on TOTP
Posted on 6/22/2021 9:18:14 AM |

NET/C# generates one-time passwords based on TOTP
Posted on 7/28/2020 6:35:33 PM |
Come and take a look, thanks for sharing
Posted on 10/10/2020 3:08:50 PM |
I was thinking of a client-side authentication solution
Posted on 10/13/2020 5:44:56 PM |
Take a look, thanks for sharing
Posted on 10/23/2020 3:16:12 PM |
Ask for the source code!
Posted on 3/18/2021 2:54:32 PM |
The generated ones are not as good as the stacks on the computer
Posted on 4/20/2021 11:10:39 AM |
Come and take a look, thanks for sharing
Posted on 8/14/2021 10:37:31 AM |
Useful Thanks for sharing
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com